Skip to content

Instantly share code, notes, and snippets.

@kosir kosir/ forked from kristjan/
Created Mar 27, 2016

What would you like to do?
Google Spreadsheet row insertion example
# $auth from
# $spreadsheet_id from
# $worksheet_id from
curl \
--header "Authorization: GoogleLogin auth=$auth" \
--header 'Content-Type: application/atom+xml' \
-d @data.xml \
# Example data in data.xml
curl \
--data-urlencode Email=$email --data-urlencode Passwd=$password \
-d accountType=GOOGLE \
-d source=Google-cURL-Example \
-d service=wise
# If you have 2-factor auth enabled, you need to create an application password to use here
# Response includes an "Auth=..." line with your token
Note headers are lowercase. I haven't checked if that matters, but it's how Google response to a GET.
This schema matches the spreadsheet at
which looks like:
Fruit | Color | Size
====================== <- Header bar in UI; not sure if this matters or if Google uses the first row anyway
Apple | Red | Medium
<entry xmlns=""
# $auth from
# $spreadsheet_id from
# $worksheet_id from
curl \
--header "Authorization: GoogleLogin auth=$auth" \
# Example response data:
# <title type="text">Apple</title>
# <content type="text">color: Red, size: Medium</content>
# <gsx:fruit>Apple</gsx:fruit>
# <gsx:color>Red</gsx:color>
# <gsx:size>Medium</gsx:size>
# $auth from on the line reading Auth=...
curl \
--header "Authorization: GoogleLogin auth=$auth" \
# Look in this response for your spreadsheet ID / worksheet fetch URL in the <link rel="...#worksheetsfeed" href="..." />
# Example spreadsheet:
# GET response: <link rel="" type="application/atom+xml" href=""/>
# URL / $spreadsheet_id from
curl \
--header "Authorization: GoogleLogin auth=$auth" \
# Look for your worksheet ID / rows URL in <link rel="...#listfeed" href="..." />
# Eg, this shows worksheet ID "od6"
# <link rel="" type="application/atom+xml" href=""/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.