Skip to content

Instantly share code, notes, and snippets.

@modsaid
Last active September 15, 2015 08:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save modsaid/9437e283c4b2dd2dfe31 to your computer and use it in GitHub Desktop.
Save modsaid/9437e283c4b2dd2dfe31 to your computer and use it in GitHub Desktop.
Convert batch csv files into xlsx in a single command
#!/bin/bash
# This script uses ssconvert to convert all *.csv files in the current directory into *.xlsx format
command -v ssconvert >/dev/null 2>&1 || { echo >&2 "ssconvert is not installed, please install it via apt-get install gnumeric"; exit 1; }
find . -maxdepth 1 -name "*.csv" -exec ssconvert {} --export-type=Gnumeric_Excel:xlsx2 \;
@modsaid
Copy link
Author

modsaid commented Sep 14, 2015

Relying on find and exec instead of loops to handle file names with spaces and other special characters

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