dilshod / xlsx2csv

Convert xslx to csv, it is fast, and works for huge xlsx files
MIT License
1.66k stars 302 forks source link

Xlsx2csv always chooses the first worksheet #239

Open brand17 opened 2 years ago

brand17 commented 2 years ago

I am trying:

from xlsx2csv import Xlsx2csv
Xlsx2csv('Book1.xlsx', sheet_name='Sheet2').convert('myfile.csv')

But it always saving the first worksheet.

Tried versions 0.8.0 and 0.7.8. My python version is 3.10.5 64-bit.

mrRobot62 commented 2 years ago

an easy workaround is to try this :-)

This example load the 2nd sheet from Book1.xlsx Xlsx2csv('Book1.xlsx', sheet_id=2).convert('myfile.csv',sheet_id=2)

Sheets are numbered up from 1 to n. Try to use id's instead of real sheet name. That works on my side with 0.7.4 (btw: this version contains the same error as your discribed)

mrrcollins commented 9 months ago

I looked at the source, the format is slightly different. This worked for me where the sheet name was updates

Xlsx2csv("updates.xlsx").convert("updates.csv",sheetname="updates")