This script will help you to extract Worksheets from an Excel file. It already saved me days of my lifetime!
Clone this repository and try to run the example file. The file has 3 worksheets: Worksheet 1
, Another data set
and Last
git clone git@github.com:zauberware/excel-worksheets-to-csv.git && cd excel-worksheets-to-csv
python worksheet_to_csv.py example.xlsx
Now you should see Worksheet 1.csv
, Another data set.csv
and Last.csv
in the exports folder.
To export all worksheets to CSV run python worksheet_to_csv.py example.xlsx
like in the example.
To export only specific worksheets you can specify them comma seperated as the second argument of the script.
Example: Export only Worksheet 1
and Last
:
python worksheet_to_csv.py example.xlsx "Worksheet 1,Last"
- Be sure
openpyxl
andimp
is installed. - Convert your file into XLSX format if needed. It not works with other excel formats.