framework icon indicating copy to clipboard operation
framework copied to clipboard

Writing of two sheets into one excel file not possible

Open djsjo opened this issue 2 years ago • 1 comments

I'm working on a project where I have to generate an Excel (.xlsx) from database information. The Excel File has to have two sheets. I'm trying to solve this by generating two resources and using the write method for each of them on the same path. But unfortunately, the later operation always overwrites the old sheet in the file.

That's the important part of the code:

resourceAnweisungen = Resource(data=scriptData,
                                   schema="scripts/schema.xlsx.lohctopusMitKontrollint.json")
resourceInformation = Resource(data=scriptInfo,
                                   schema="scripts/schema.xlsx.lohctopus.informationen.json")

.....
# write the data in a local xlss
target = resourceAnweisungen.write('scripts/first_output_script_download.xlsx',
                                       control=formats.ExcelControl(sheet='anweisungen'))
target = resourceInformation .write('scripts/first_output_script_download.xlsx',
                                       control=formats.ExcelControl(sheet='informationen'))

I assume it's a bug, or it was implemented only with one sheet in mind?

djsjo avatar Jul 24 '23 08:07 djsjo

Thank you @djsjo for reporting!.

shashigharti avatar Jul 25 '23 02:07 shashigharti