Skip to content

Instantly share code, notes, and snippets.

@lukeledet
Created November 4, 2016 14:30
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 lukeledet/4bfeca0a5cf963a2caed929719b7185b to your computer and use it in GitHub Desktop.
Save lukeledet/4bfeca0a5cf963a2caed929719b7185b to your computer and use it in GitHub Desktop.
Format SQL results for a Google spreadsheet
#!/bin/bash
# Pipe SQL commands to this command to get them in a format ready for a Google Spreadsheet
DB=${1-$USER}
shift
QUERY=$(cat <&0)
psql --field-separator=$'\t' --no-align --pset=footer=off -c "$QUERY" "$@" $DB
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment