No description
| docs | ||
| internal/version | ||
| magefiles | ||
| .gitignore | ||
| CLAUDE.md | ||
| go.mod | ||
| go.sum | ||
| main.go | ||
| README.md | ||
csv2excel
A command-line tool that converts one or more CSV files into a single Excel (.xlsx) file. Each CSV file becomes a separate worksheet, named after the source file.
Features
- Merges multiple CSV files into one Excel workbook
- Auto-detects the delimiter (
,,;,\t) - Supports UTF-8 and Windows-1252 encoding
- Tolerant with malformed CSV files (
LazyQuotes) - Version info injected at build time via git tags
Installation
From source
Requires Go 1.21+.
git clone https://code.beautifulmachines.dev/jakoubek/csv2excel
cd csv2excel
go install .
Build with Mage
Requires Mage.
mage Build # current platform (auto)
mage BuildWindows # dist/csv2excel.exe
mage BuildLinux # dist/csv2excel
mage Install # install to $GOBIN
mage Clean # remove dist/
Usage
csv2excel [flags] file1.csv file2.csv ...
Flags
| Flag | Default | Description |
|---|---|---|
-o |
output.xlsx |
Output file path |
-sep |
auto |
Delimiter: auto, ,, ;, \t |
-enc |
utf8 |
Encoding: utf8, windows1252 |
Examples
# Convert a single file
csv2excel data.csv
# Merge multiple files into one workbook
csv2excel -o report.xlsx sales.csv inventory.csv customers.csv
# Force semicolon delimiter, Windows-1252 encoding
csv2excel -sep ";" -enc windows1252 -o result.xlsx export.csv
Each CSV file becomes a worksheet named after the filename (without extension). Sheet names are truncated to 31 characters to comply with Excel's limit.
Dependencies
- excelize — Excel file creation and manipulation
- golang.org/x/text — Character encoding support
License
MIT