csv2xlsx: make an Office Open XML file from files of comma-separated values

This simple C program reads one or more comma-separated values (CSV) files and uses the libxlsxwriter library to make a Office Open XML spreadsheet file (usually with the .xlsx file extension).

Download

Compile

  1. If you have not already done so, install the libxlsxwriter library and its header files. For example, in Debian: sudo apt -q install libxlsxwriter-dev
  2. Download one of the archive files.
  3. Unpack the archive file. For example:
    • To unpack csv2xlsx.tar.gz: tar -xzf csv2xlsx.tar.gz
    • To unpack csv2xlsx.zip: unzip -q csv2xlsx.zip
  4. Go to the csv2xlsx directory. For example: cd csv2xlsx
  5. Compile and link the executable file. For example:
    • With make: make
    • Without make: gcc -o csv2xlsx csv2xlsx.c -lxlsxwriter

Examples

Single sheet

Make data.xlsx with a sheet with the name data from data.csv:

Multiple sheets

Make data.xlsx with sheets with the names data1, data2, and data3 from the files file1.csv, file2.csv, and file3.csv: ./csv2xlsx -o data.xlsx -s data1 -s data2 -s data3 file1.csv file2.csv file3.csv