Skip to content

Instantly share code, notes, and snippets.

@yoursdearboy
Created August 13, 2019 11:01
Show Gist options
  • Save yoursdearboy/f83bd0e73de424a21ba7114be762e4bb to your computer and use it in GitHub Desktop.
Save yoursdearboy/f83bd0e73de424a21ba7114be762e4bb to your computer and use it in GitHub Desktop.
Compare XLSX files using [daff](http://paulfitz.github.io/daff/)
[diff "xlsx"]
command = xlsx2daff diff
[diff "csv"]
command = daff diff --git
#!/bin/sh
if [ "${#@}" -lt 7 ]
then
echo "Expected more arguments from Git"
exit 1
fi
NEW=${@: -7 : 1}
OLD=${@: -6 : 1}
REST_ARGS=${@: 0 : ${#@}-6}
# CSV conversion
NEW_CSV=$(mktemp)
OLD_CSV=$(mktemp)
xlsx2csv $NEW $NEW_CSV
xlsx2csv $OLD $OLD_CSV
# Daff
daff $REST_ARGS $OLD_CSV $NEW_CSV
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment