I'm trying to convert a .csv file to Excel using unix shell script. Tried replacing pipe delimited to Comma separated using the below script.
#!/bin/bash
cd /main/subpath/dev/Int/Source/adm/at/csv_xls
for f in *.csv; do
sed 's/^\||/,/g' "$f" > "${f%.csv}.xls"
done
ls *.csv;
echo "CSV Excel Con" | mailx -s "Testing CSV2Excel" -a "${f%.csv}.xls" [email protected]
I have multiple Excel files. I need to send all the Excel files as email attachments. When I tried using this script it is attaching only one file. Please provide your suggestions. Thanks!
CodePudding user response:
You can simply use ssconvert
ssconvert file1.csv file1.xlsx