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

Download a compressed archive file:

Unpack

Unpack the archive file. For example:

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. Go to the csv2xlsx directory. For example: cd csv2xlsx
  3. 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