Skip to content

Instantly share code, notes, and snippets.

@stami
Last active March 4, 2021 04:03
Show Gist options
  • Save stami/84547b5cd55da4a6498c to your computer and use it in GitHub Desktop.
Save stami/84547b5cd55da4a6498c to your computer and use it in GitHub Desktop.
Bash Unoconv Libreoffice CSV-to-Excel converter
#!/bin/bash
# Huikee CSV-to-XLSX konvertteri by Samuli
# Versio 2.0, using unoconv
# Unicode now works
root_dir=$(pwd)
FOLDERS=$(find $root_dir -type d)
for fol in $FOLDERS
do
cd $fol
echo 'Fol: ' $fol
for file in *.csv
do
echo $file
unoconv -d spreadsheet -f xls -i FilterOptions=44,34 -o $fol/ $file
# FilterOptions
# 44 for field separator ','
# 34 for text delimiter '"'
# (76 for encoding UTF-8)
done
done
cd $root_dir
echo 'All done.'
@d9k
Copy link

d9k commented Jun 5, 2018

works for cyrillic utf-8 csv input!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment