Python Forum
Saving Excel workbook file with dataframe names
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Saving Excel workbook file with dataframe names
#1
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 -
Error:
save() takes 1 positional argument but 2 were given
could you assist me if this is right way to do it

dfs={"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))
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Python openyxl not updating Excel file MrBean12 1 250 Mar-03-2024, 12:16 AM
Last Post: MrBean12
  Copy Paste excel files based on the first letters of the file name Viento 2 348 Feb-07-2024, 12:24 PM
Last Post: Viento
  Search Excel File with a list of values huzzug 4 1,147 Nov-03-2023, 05:35 PM
Last Post: huzzug
  Updating sharepoint excel file odd results cubangt 1 755 Nov-03-2023, 05:13 PM
Last Post: noisefloor
  How to copy work sheet data one workbook to other? sayyedkamran 2 645 Nov-03-2023, 09:10 AM
Last Post: Larz60+
  xlwings error when reading a workbook Mishal0488 1 1,037 Aug-01-2023, 02:05 AM
Last Post: deanhystad
  Reading data from excel file –> process it >>then write to another excel output file Jennifer_Jone 0 1,046 Mar-14-2023, 07:59 PM
Last Post: Jennifer_Jone
  Save and Close Excel File avd88 0 2,840 Feb-20-2023, 07:19 PM
Last Post: avd88
  Trying to access excel file on our sharepoint server but getting errors cubangt 0 773 Feb-16-2023, 08:11 PM
Last Post: cubangt
  Converting a json file to a dataframe with rows and columns eyavuz21 13 4,170 Jan-29-2023, 03:59 PM
Last Post: eyavuz21

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020