Created
January 19, 2012 08:34
-
-
Save vadimii/1638779 to your computer and use it in GitHub Desktop.
Download data from Google Spreadsheets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib2 | |
DOC_PATH = 'https://docs.google.com/spreadsheet/pub?key=%s&output=txt' | |
GID_PARAM = '&single=true&gid=%s' | |
def load(docid, sheetid=None): | |
srcpath = DOC_PATH % docid | |
if sheetid != None: srcpath = srcpath + (GID_PARAM % sheetid) | |
src = urllib2.urlopen(srcpath) | |
return [l.split('\t') for l in src.readlines()] | |
if __name__ == '__main__': | |
testid = '0Atgd-n28fU3PdGlsMTdLRUFqR3JvbktmcWhqTFpSZmc' | |
print len(load(testid, 0)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment