Skip to content
This repository was archived by the owner on Nov 26, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions etc/gdocs.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,17 @@ class GoogleDoc(object):
key = None
file_format = 'xlsx'
file_name = 'copy'
gid = '0'
gid = None

# You can change these with kwargs but it's not recommended.
spreadsheet_url = 'https://spreadsheets.google.com/feeds/download/spreadsheets/Export?key=%(key)s&exportFormat=%(format)s&gid=%(gid)s'
new_spreadsheet_url = 'https://docs.google.com/spreadsheets/d/%(key)s/export?format=%(format)s&id=%(key)s&gid=%(gid)s'
spreadsheet_url = 'https://spreadsheets.google.com/feeds/download/spreadsheets/Export?key=%(key)s&exportFormat=%(format)s'
if gid:
spreadsheet_url = spreadsheet_url + '&gid=%(gid)s'

new_spreadsheet_url = 'https://docs.google.com/spreadsheets/d/%(key)s/export?format=%(format)s&id=%(key)s'
if gid:
new_spreadsheet_url = new_spreadsheet_url + '&gid=%(gid)s'

auth = None
email = os.environ.get('APPS_GOOGLE_EMAIL', None)
password = os.environ.get('APPS_GOOGLE_PASS', None)
Expand Down
5 changes: 4 additions & 1 deletion fabfile/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from etc.gdocs import GoogleDoc

@task(default=True)
def update():
def update(gid=None):
"""
Downloads a Google Doc as an Excel file.
"""
Expand All @@ -25,6 +25,9 @@ def update():
bits = bits[1].split('&')
doc['key'] = bits[0]

if gid:
doc['gid'] = gid

g = GoogleDoc(**doc)
g.get_auth()
g.get_document()
Expand Down