コンプリート! get sheet name excel python pandas 323648
Excel Sheet used In this excel sheet we are having three categories in Species columnSetosa; Since all xlsx are basically zipped files, we extract the underlying xml data and read sheet names from the workbook directly which takes a fraction of a second as compared to the library functions Benchmarking (On a 6mb xlsx file with 4 sheets) Pandas, xlrd 12 seconds openpyxl 24 seconds Proposed method 04 seconds import pandas as pd sheets_dict = pdread_excel('Book1xlsx', sheetname=None) full_table = pdDataFrame() for name, sheet in sheets_dictitems() sheet'sheet' = name sheet = sheetrename(columns=lambda x xsplit('\n')1) full_table = full_tableappend(sheet) full_tablereset_index(inplace=True, drop=True) print full_table Python Import Excel File Using Pandas Keytodatascience Get sheet name excel python pandas