Bash Scripts

Converting Excel files to CSV in Linux

Install xls2csv

yum -y install xls2csv

To convert your xls file to csv, just type this command:

xls2csv filename.xls > filename.csv

This script is very useful if you have a lot of excel files to convert. This will help you save a lot of time than converting it one by one.

  1. #!/bin/bash
  2. ls *.xls | while read file
  3. do
  4. filename=`echo $file | cut -d . -f 1`
  5. xls2csv "$file" > "$filename".csv
  6. done