def __init__(self, file_item, *, use_session=True, persist=True):
        """ Create a workbook representation

        :param File file_item: the Drive File you want to interact with
        :param Bool use_session: Whether or not to use a session to be more efficient
        :param Bool persist: Whether or not to persist this info
        """
        if file_item is None or not isinstance(file_item, File) or file_item.mime_type != EXCEL_XLSX_MIME_TYPE:
            raise ValueError('This file is not a valid Excel xlsx file.')

        if isinstance(file_item.protocol, MSOffice365Protocol):
            raise ValueError('Excel capabilities are only allowed on the MSGraph protocol')

        # append the workbook path
        main_resource = '{}{}/workbook'.format(file_item.main_resource,
                                               file_item._endpoints.get('item').format(id=file_item.object_id))

        super().__init__(protocol=file_item.protocol, main_resource=main_resource)

        persist = persist if use_session is True else True
        self.session = WorkbookSession(parent=file_item, persist=persist, main_resource=main_resource)

        if use_session:
            self.session.create_session()

        self.name = file_item.name
def __init__ ( self , file_item , * , use_session = True , persist = True ) : if file_item is None or not isinstance ( file_item , File ) or file_item . mime_type != EXCEL_XLSX_MIME_TYPE : raise ValueError ( 'This file is not a valid Excel xlsx file.' ) if isinstance ( file_item . protocol , MSOffice365Protocol ) : raise ValueError ( 'Excel capabilities are only allowed on the MSGraph protocol' ) main_resource = '{}{}/workbook' . format ( file_item . main_resource , file_item . _endpoints . get ( 'item' ) . format ( id = file_item . object_id ) ) super ( ) . __init__ ( protocol = file_item . protocol , main_resource = main_resource ) persist = persist if use_session is True else True self . session = WorkbookSession ( parent = file_item , persist = persist , main_resource = main_resource ) if use_session : self . session . create_session ( ) self . name = file_item . name
Create a workbook representation

        :param File file_item: the Drive File you want to interact with
        :param Bool use_session: Whether or not to use a session to be more efficient
        :param Bool persist: Whether or not to persist this info