cURL and Google Spreadsheets

December 06, 2011

I failed to find a good example of something that worked to pull a spreadsheet from google-docs using cURL. All that I found didn’t work, in one shape or another.

A bit of playing, and quite a bit of reading got this

PASS=`cat /path/to/0600/google-password-file`
<p>AUTH_TOKE=`curl --silent -d \ -d \
    Passwd=${PASS} -d \
    accountType=HOSTED -d \
    source=cURL-SpreadPull -d \
    service=wise | grep Auth\= | sed 's/Auth/auth/'`</p>
<p>curl --silent --output /path/to/file --header "GData-Version: 3.0" --header "Authorization: GoogleLogin ${AUTH_TOKE}" "${SHEET}${TAB}"

seemed to do the trick

Exportkey could be defined in the script, as a variable, thinking about it. You’ll need to supply that; I typically grab it from the web-based URI, but there is a warning in the docs about that:

*To determine the URL of a cell-based feed for a given worksheet, get the worksheets metafeed and examine the element in which rel is The href value in that element is the cell feed’s URI.*


I’ve added in &#038;exportFormat=csv&#038;gid= because I wanted CSV outputs, and gid’s value is provided via a for … and case deviation.

--header "GData-Version: 3.0" was needed to avoid the redirection.

Hopefully, this might be of benefit — as a working (when written) example of using curl and google docs/google spreadsheets.

Some notes on LetsEncrypt

I've been playing with LetsEncrypt for a bit now, and on the whole, I like it. However, it's still early days, and I wanted to share my e...… Continue reading

Bloody Twitter

Published on December 02, 2013