Skip to content

xls2csv is a program which converts XLS files to CSV files. It's based on xls2csv.c of libxls.

License

Notifications You must be signed in to change notification settings

northbright/xls2csv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

xls2csv

Build Status

xls2csv is a program which converts XLS files to CSV files. It's based on xls2csv.c of libxls.

Features

  • Specify sheet by given sheet ID.
  • Convert CSV in the same way as Excel's "Save as CSV".
    • Use ',' as separator.
    • No "" for string.
    • Keep data if rowspan > 1(original xls2csv.c will stop and return).

Build

  • xls2csv requires libxls to be installed.

    • Install libxls

        wget https://github.com/libxls/libxls/releases/download/v1.6.2/libxls-1.6.2.tar.gz
        tar -xzvf libxls-1.6.2.tar.gz
        cd libxls-1.6.2
        ./configure
        make
        sudo make install
      
    • Add libxls lib path to LD_LIBRARY_PATH

      • Create a new /etc/ld.so.conf.d/libxls.conf

            sudo vi /etc/ld.so.conf.d/libxls.conf
        
            // Add path of libxls to this file
            /usr/local/libxls/lib
        
      • Update LD_LIBRARY_PATH

          sudo ldconfig
          // Check libxlsreader.so
          sudo ldconfig -p | grep libxls
        
  • Build xls2csv

      git clone https://github.com/northbright/xls2csv.git
      cd xls2csv/src
      gcc -o xls2csv *.c -I/usr/local/libxls/include -L/usr/local/libxls/lib -lxlsreader
    

Usage

xls2csv [XLS file] [-s sheet ID(0-based)] [-o CSV File]

-s sheet ID. It's 0-based. Default is 0 if no sheet id specifed.
-o CSV file to output. If no CSV file is specified, it'll output CSV string to stdout.

Example:

xls2csv my.xls 
xls2csv my.xls -s 2 -o my.csv

License

Thanks

  • Thanks powerful libxls to give it a chance that we can still operate on XLS file.

About

xls2csv is a program which converts XLS files to CSV files. It's based on xls2csv.c of libxls.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages