Saving Excel workbook file with dataframe names - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Saving Excel workbook file with dataframe names (/thread-27450.html) |
Saving Excel workbook file with dataframe names - Biplab1985 - Jun-07-2020 Hi Guys, I am exporting multiple dataframes to excel template - GMC_template.xlsx which has formulas for further calculations. the below codes works well, when i am exporting the dataframes to each sheet of workbook but does not work when i export the dataframes to workbook template and save with dataframe name. error message - could you assist me if this is right way to do itdfs={"MAY":May_date,"JUN":June_date,"JUL":July_date,"AUG":Aug_date,"SEP":Sep_date,"OCT":Oct_date,"NOV":Nov_date,"DEC":Dec_date, "YTD":YTD,"Q3":Q3,"Q4":Q4,"HY2":HY2} pth="Y:\\WEST\\2. BE\\4. MPM Belgium\\2020\\GMC Prep Automation\\Data_Prep_Python\\LEvsLY_Output\\" Writer =pd.ExcelWriter("GMC_Template.xlsx", engine="xlsxwriter") for dataset in dfs.keys(): dfs[dataset].to_excel(Writer,index=False,startrow=1,startcol=19,header=False) Writer.save(os.path.join(pth,dataset)) |