loading workbook from an excel file loading workbook from an excel file of coursein many cases it is necessary not just to create excel files for data export but also to import data from an existing excel file this can be done using the openpyxl load_workbook(function this function opens the specified excel file (in read only mode by defaultand returns workbook object from openpyxl import load_workbook workbook load_workbook(filename='sample xlsx'you can now access list of sheetstheir namesobtain the currently active sheet etc using properties provided by the workbook objectworkbook active returns the active worksheet object workbook sheetnames returns the names (stringsof the worksheets in this workbook workbook worksheets returns list of worksheet objects the following sample application reads the excel file created earlier in this from openpyxl import load_workbook def main()print('starting reading excel file using openpyxl'workbook load_workbook(filename='sample xlsx'print(workbook activeprint(workbook sheetnamesprint(workbook worksheetsprint('- ws workbook['my worksheet'print(ws[' ']print(ws[' 'valueprint(ws[' 'valueprint(ws[' 'valueprint('- for sheet in workbookprint(sheet titleprint('- cell_range ws[' ':' 'for cell in cell_rangeprint(cell[ valueprint('-