Search code examples
linuxcsvxlsconverters

XLS multiple files convert to single csv in Linux


On a daily basis, I have received 20 .xls files in Linux box. Each file start from 6 row and convert into single.csv file. For example,

  • .xls file 1 contains 106 rows
  • .xls file 2 contains 206 rows
  • .xls file 3 contains 56 rows

All three files data convert into a single CSV file. Single CSV file count should be 350.

I am using the command below to convert, but it is working one by one file not bulk mode.

unoconv -f csv -e FilterOptions="59,0,0,1"  test_amount1.xls  
unoconv -f csv -e FilterOptions="59,0,0,1"  test_amount2.xls  
unoconv -f csv -e FilterOptions="59,0,0,1"  test_amount3.xls  

Can anyone let me know how to implement single shot all files conversion from .xls to .csv


Solution

  • Not sure what you want but I assume you want to convert each xls file, then concatenate them all.

    for input in test_amount*.xls; do
        unoconv -f csv -e FilterOptions="59,0,0,1" --stdout $input | tail -n +7
    done >output.csv