Igor
Igor

Reputation: 61

Problem downloading google spreadsheet using curl

I am trying to download a worksheet from google spreadsheets using curl. I checked their documentation and online resources but I am still having trouble.

I obtained the key using the script below:

curl https://www.google.com/accounts/ClientLogin -d [email protected] -d Passwd=XXX -d accountType=HOSTED_OR_GOOGLE  -d source=cURL-Example -d service=wise

Which is this:

SID=DQAAAJwAAAA78qHwii5HL6TbN1se0waXBGqLWXX0cuoI7JHNzB0AlAP8e5Zz1t2oCxBgHlrVH4UY67A6vrQ9-2K2gp5l-xmpNKruvBvWQ0HvLcGO0dTJSlwY1cvOLe7PcDOdZ_AuYRoHsb_LNr_oCDRgdiHvKfVKFpPZlQvRCKPccJcHD-pMxV6MWQvmrXFUdKWN13XUC-PG7ZJ-ANCl9Z-FJ
LSID=AAJ4AAACIposyFJ0-lzRsXPGPi7zALMRSiUtUknUYT3w7b4WhvTo7YRly-YUNBwwCqb-kjt79_aAqSGG5A_tUfeBySAV0gJ-SaRU-J47fZP09e4TtFzowVfcWphdF-7xoFhl2m9_J0erE22vC33CzIER6ykPa0-Jw0_510jF2TiXNuS30Miq8kO0iXbKxfQXkYspCZyyt1bs_GAndivPsv7xi7
Auth=DQAAAJ4AAACIposyFJ0-lzRsXPGPi7zALMRSiUtUknUYT3w7b4WhvTo7YRlyYUNBwwCqkjt7Wbdh0uT_kGccEju0a-CbIwm6OfD2p6LdlrtwEua8VVJu4DSUWkuiu0-jrfTd9JCqJNNveT5-cz9tGOi5Y3KWrIfRUue1DFmCCePOz9sNSBwpOtukcjhWVsrB4E9azIuIztV8h05V-T1GBbGe0Q

After that I use the command below:

curl --silent --header "Authorization: GoogleLogin auth=DQAAAJ4AAACIposyFJ0-lzRsXPGPi7zALMRSiUtUknUYT3w7b4WhvTo7YRly-YUNBb-kjt7Wbdh0uT_kGcY1NcEju0a-CbIwm6OfD2p6LdlrtwEua8VVJu4Dkuiu0-jrfTd9JCqJNNveT5-cz9tGOi5Y3KWrIfRUue1DFmCCePOz9sNSBwpOtukcjhWVsrB4E9azIuIztV8h05V-T1GBbGe0Q" http://spreadsheets.google.com/feeds/download/spreadsheets/Export?key=0Akfdf7Ce1qZ3dFpfa4WVNlWUxrMmdTNU53cFhDZFE&hl&exportFormat=xls

When I enter the curl command above I get an error saying hl: command not found followed by a bunch of junk that the terminal can't read.

I would really appreciate if someone could tell me what I am doing wrong here or another way I can automate my downloads.

ps. I took some characters in the authentication keys since i'm not sure what data they posses and how it may be used.

Thanks

Upvotes: 2

Views: 1429

Answers (1)

mjhm
mjhm

Reputation: 16705

You need put quotes on the last argument. The '&' is being interpreted by the shell.

Upvotes: 1

Related Questions