I need to export 24 pandas data frames (140 columns of 400 rows) to Excel , each on a different sheet.
I use pandas built-in ExcelWriter . Performing 24 scenarios, it is required:
51 seconds to write to the .xls file (using xlwt )
86 seconds to write to the .xlsx file (using XlsxWriter )
141 seconds to write to the .xlsm file (using openpyxl )
21 seconds to run the program (without Excel output)
The problem with writing to .xls is that the table does not contain formatting styles, so if I open it in Excel, select the column and click the comma button to format the numbers, this tells me: "style comma not found. I I am not going to write this problem in .xlsx , but it is even slower.
Any suggestions on expediting exports? I may not be the first to have this problem, but after several hours of searching on forums and websites, I have not found a definite solution.
The only thing I can think of is to use Python to export to CSV files and then write an Excel macro to combine all the CSV files into one table.
The .xls file is 10 MB, and the .xlsx 5.2 MB
Thanks!
source share