Skip to content

Instantly share code, notes, and snippets.

@OneOfOne
Created May 14, 2021 22: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 OneOfOne/bd06b332abdc83e82148db30e8a212e0 to your computer and use it in GitHub Desktop.
Save OneOfOne/bd06b332abdc83e82148db30e8a212e0 to your computer and use it in GitHub Desktop.
#!/bin/sh
function convert() {
local fp="$(realpath "$1")"
local d=""
if [ -d "$fp" ]; then
d="$fp"
fp="$d/*.xlsx"
else
d="$(dirname "$fp")"
fi
echo libreoffice --headless --convert-to csv --outdir "$d" "$fp"
libreoffice --headless --convert-to csv --outdir "$d" "$fp"
}
for fp in "$@"; do
convert "$fp"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment