Journal‎ > ‎

Using cURL to download a Google Spreadsheet as .xls (Excel)

posted Dec 2, 2011, 5:54 PM by Saqib Ali   [ updated Dec 3, 2011, 10:43 AM ]

First obtain a Authentication Token:
 
# curl https://www.google.com/accounts/ClientLogin -d Email=user@quantumcrypto.de -d Passwd=mysecretpassword -d accountType=HOSTED_OR_GOOGLE  -d source=cURL-Example -d service=wise

This will return something that looks as follows:

SID=DQAAAHYBADCv2pSv7nflacDNwz3zEDUGtrSvNVDcpkSfddi77b3U5sEaHmP8YLWhmA36F9rk85mL8J5dqo4apn0T1vKz0fPGI9Xtnuet6cuE2ZzYvrNIwbSC_HjTqF4zudNQnnlDuD2wqZT-g1qXI8KhGAQZV4NexHZoQPlabTsGuRZeIBxj1A 
LSID=EUBBBIaBADCl-kNxvRVmcQghpt3cqSMfEooKR9flLOUZqwgP9OrZS83gse-KSdTNeXhxsET7FYenDhceP9lIPOmesH-t9qh-AWUHjjMdZEbUNeF9mWyzln6Z-FajaiG-cVFkqW0ZJ8ZbnCP30xXj6xFK6QxaAcqy_9Pej8jhEnxS9E61ftQGPg 
Auth=EUBBIacAAADK-kNxvRVmcQghpt3cqSMfEooLNMflLNIQqwgP9OrZS83gs-KSdTNeXhxsET7FYePWmaD8Vsy1V4LSUGMUP48Je2TO8OcjBj6HgAtPhiZeX-gKDfagZDK44j4n-Tkb44nhOnp2_QPSnBj3Z2vYwOEDjjG3Q53aQVC2132JKOuGh
 

To export a Google Spreadsheet as .xls (Excel): 
# curl --silent --header "Authorization: GoogleLogin auth=AUTHKEY" http://spreadsheets.google.com/feeds/download/spreadsheets/Export?key=spreadsheetkey&exportFormat=xls 


exportFormat Parameter Value Format of the returned Spreadsheet
 xls XLS (Microsoft Excel)
 csv CSV (Comma Separated Value)
 pdf PDF (Portable Document Format)
 ods ODS (Open Document Spreadsheet)
 tsv TSV (Tab Separated Value)
 html HTML Format
 

Comments