Here are a few notes I took while getting the authorization going. Google's documentation is rather thin, I think. Hope this may help someone.
As of 2017, authentication does not work anymore as described here.
Check out this post - much more accessible than the 'official' documentation: https://developers.google.com/gdata/articles/using_cURL#authenticating-clientlogin
Create a new spreadsheet via http://drive.google.com
Create new app specific password via https://security.google.com/settings/security/apppasswords
Create Auth token with app specific password:
curl -v https://www.google.com/accounts/ClientLogin --data-urlencode Email=yourname@gmail.com --data-urlencode Passwd=... -d accountType=GOOGLE -d service=wise
Doesn't have to be a GMail address - use the address of your Google account.
I also used -d source=...
(as in the 'using curl' document above) but I guess it's unnecessary.
As for the wise
string - see https://developers.google.com/gdata/faq#clientlogin for a list of service names.
Copy auth key: Auth=...
in the document returned by the server.
If you can get the authentication working somehow (I didn't), the rest may still work:
Get list of your spreadsheets: curl -v -H 'Authorization: GoogleLogin auth=...' https://spreadsheets.google.com/feeds/spreadsheets/private/full > spreadsheets.xml
Find worksheets URL for your spreadsheet: xmllint --format spreadsheets.xml | less
Look for the name of your spreadsheet, copy the href from <link rel="http://schemas.google.com/spreadsheets/2006#worksheetsfeed".../>
Explained here: https://developers.google.com/google-apps/spreadsheets/#retrieving_information_about_worksheets, but with a different rel URI. :-(
Get list of worksheets in your spreadsheet: curl -v -H 'Authorization: GoogleLogin auth=...' https://spreadsheets.google.com/feeds/worksheets/.../private/full >worksheets.xml
Find listfeed URL for your worksheet: xmllint --format workheets.xml | less
Should be described here: https://developers.google.com/google-apps/spreadsheets/#adding_a_list_row , but again, the URIs don't match what I'm seeing... <link rel="http://schemas.google.com/spreadsheets/2006#listfeed".../>
looks good...
Finally, add the row. This is the part that user2029890 describes in their answer: curl -v -H 'Content-Type: application/atom+xml' -H 'Authorization: GoogleLogin auth=...' -d '<entry xmlns="http://www.w3.org/2005/Atom" xmlns:gsx="http://schemas.google.com/spreadsheets/2006/extended"><gsx:id>123</gsx:id><gsx:user>bob</gsx:user></entry>' https://spreadsheets.google.com/feeds/list/.../.../private/full
The XML element names, e.g. gsx:id
and gsx:user
, have to match the column headers.
The XML parser is quite picky - it requires double quotes around attribute values.