benlk / looming_midterms

A Twitter cronjob bot to count down to the midterm elections
https://twitter.com/looming_midterm
Creative Commons Attribution Share Alike 4.0 International
0 stars 0 forks source link

Script to download copy sheet from Google Docs #4

Closed benlk closed 6 years ago

benlk commented 7 years ago

As part of #1:

  • [ ] thing to download list of dates of things

This will fetch the spreadsheet https://docs.google.com/spreadsheets/d/1Gx3KrCzldP7uYOi3lp6aZSkIZ80C_oZKsaj2CeKSBUM/edit#gid=1275143625 from Google and save it locally.

fab update_copy grabs the latest copy of the spreadsheet: https://github.com/nprapps/dailygraphics/blob/dc5ba2bf0e2230e27b67c85c320ddc984f01df21/fabfile/__init__.py#L159-L176

That uses download_copy: https://github.com/nprapps/dailygraphics/blob/dc5ba2bf0e2230e27b67c85c320ddc984f01df21/fabfile/__init__.py#L139-L156

That uses some stuff imported from oauth: https://github.com/nprapps/dailygraphics/blob/dc5ba2bf0e2230e27b67c85c320ddc984f01df21/fabfile/__init__.py#L13

Which is all defined in oauth.py, https://github.com/nprapps/dailygraphics/blob/dc5ba2bf0e2230e27b67c85c320ddc984f01df21/oauth.py

benlk commented 7 years ago

https://newsnerdery.slack.com/archives/C0ETGP7UZ/p1507139828000414

if the sheet is published to csv and get that URL, you can do something like curl https://google.com/sheet/ID.csv | in2csv It requires the sheet to be publically viewable technically, but unless its really sensitive info, it shouldn't matter

And I don't think that it matters; the sheet powering this can be publicly visible.

benlk commented 6 years ago

https://stackoverflow.com/questions/24255472/download-export-public-google-spreadsheet-as-tsv-from-command-line

benlk commented 6 years ago

Alternately, use gdrive as described in https://github.com/The-Politico/gspan to pull in the file.

benlk commented 6 years ago

Closing this because it can live all as CSVs on github