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
  module 'openpyxl.workbook' has no attribute 'active' lsaavedra21 5 1,497 Oct-30-2024, 06:26 PM
Last Post: lsaavedra21
  rename same file names in different directories elnk 5 2,334 Jul-12-2024, 01:43 PM
Last Post: snippsat
  docx file to pandas dataframe/excel iitip92 1 2,259 Jun-27-2024, 05:28 AM
Last Post: Pedroski55
  Python openyxl not updating Excel file MrBean12 1 1,912 Mar-03-2024, 12:16 AM
Last Post: MrBean12
  Copy Paste excel files based on the first letters of the file name Viento 2 1,490 Feb-07-2024, 12:24 PM
Last Post: Viento
  Search Excel File with a list of values huzzug 4 2,690 Nov-03-2023, 05:35 PM
Last Post: huzzug
  Updating sharepoint excel file odd results cubangt 1 1,982 Nov-03-2023, 05:13 PM
Last Post: noisefloor
  How to copy work sheet data one workbook to other? sayyedkamran 2 1,469 Nov-03-2023, 09:10 AM
Last Post: Larz60+
  xlwings error when reading a workbook Mishal0488 1 2,230 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 2,061 Mar-14-2023, 07:59 PM
Last Post: Jennifer_Jone

Forum Jump:

User Panel Messages

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