A tool for converting Excel workbooks into separate CSV files, with one CSV file per worksheet. Available in both Python and Go implementations. The tool automatically handles line breaks in cells by replacing them with spaces, ensuring clean CSV output.
- Converts each Excel worksheet to a separate CSV file
- Automatically cleans line breaks from cells
- Preserves worksheet names as CSV filenames
- Uses UTF-8 encoding for proper character handling
- Excludes DataFrame indices from output
- Available in both Python and Go implementations
- Command-line interface for easy use
- Python 3.6 or higher
- pandas library
pip install -r requirements.txt- Go 1.16 or higher
- excelize package (automatically installed via go.mod)
go mod tidy- Clone the repository
- Install dependencies:
pip install -r requirements.txt
- Clone the repository
- Build the executable:
go build xls2csv.go
Both versions accept an Excel file path as a command-line argument:
python xls2csv.py <excel_file>./xls2csv <excel_file>Example:
# Using Python version
python xls2csv.py quarterly_report.xlsx
# Using Go version
./xls2csv quarterly_report.xlsxEach worksheet will be exported as a separate CSV file with:
- UTF-8 encoding
- No index column
- Line breaks replaced with spaces
- Filename matching the worksheet name
For example, if your Excel file quarterly_report.xlsx has worksheets named "Q1" and "Q2", you'll get:
Q1.csvQ2.csv
Both versions include error handling for common issues:
- File not found
- Invalid Excel file format
- Permission issues
- Invalid command-line arguments
Contributions are welcome! Please feel free to submit a Pull Request.
This project is open source and available under the MIT License.