xlsx with some rows like
OP20
MA20
for each row in the excel, I need to call a shell script as an argument
while read p; do
./command.sh $p
done <Name.xlsx
I have code like this but after running the code I get some junk character as output.
You have to convert your .xls file in ASCII:
xls2csv Name.xlsx | xargs -d $'\n' -n 1 ./command.sh
Than xargs
will run ./command.sh
once by line, successively, with each line as arguments.
xml2csv
alternative:You could use libreoffice command line for this:
soffice --convert-to "csv" Name.xlsx
xargs -d $'\n' -n 1 ./command.sh <Name.csv
libreoffice
based solution using tab instead of coma:soffice --convert-to 'csv:Text - txt - csv (StarCalc):9,34,UTF8' --headless file.xlsx
while IFS=$'\t' read -aru ${tsv} array;do
echo "Line: $array" # show first field
declare -p array
done {tsv}<file.csv