dilshod/xlsx2csv

[Feature Request] Save each sheet as a file instead of combining into one single sheet

caffeinatedMike opened this issue · 4 comments

It would really be useful to have the ability to convert a multi-sheet xlsx file into multiple csv files instead of dumping all the text onto one sheet. Maybe the sheet names can be appended to the outfile name to create orderly filenames?

Use -s 0 option
Example: xlsx2csv -s 0 excelfile.xlsx /directory/to/write/to/
This accomplishes what you are asking for

From what the documentation provides that does not appear to be the behavior. Why else would there be sheet delimiter options? This implies all sheets are combined into a single csv and the rows of data separated via the delimiter per sheet.

I just ran it, and thats what it did. Just trying to help you out. I needed the same functionality.

Did you try it, or just dismiss my help?

Similar to what @SirCujo mentioned, you can run twice to each sheet.
The concept is:

step 1. dump everything

xlsx2csv -a excelfile.xlsx all.csv

step 2. find how many sheet your name and export every one of them

grep -- '--------' all.csv  ## this prints out sheet names
for i in {1..2}; do  xlsx2csv -s $i excelfile.xlsx sheet.$i.csv

Or just use what @SirCuju has mentioned, use -s 0 is the trick to dump all sheets in a output directory.