Last active
August 29, 2015 14:08
-
-
Save retrography/917ead56cadb9c935f03 to your computer and use it in GitHub Desktop.
xls2csv batch extractor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
cdir=ARGV[0] | |
cdir='.' if cdir.nil? | |
flist=Dir.glob(cdir.chomp('/')+'/*.xls') | |
flist.each do |x| | |
wlist=`xls2csv -x #{x} -q -W | tail -n +4 | head -n -1`.split( /\r?\n/ ) | |
wlist.each do |y| | |
fname=x.chomp('xls')+y+'.csv' | |
puts `xls2csv -x #{x} -w #{y} -c #{fname}` | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This one only converts the active worksheet of the Excel file into CSV: