0

I am working on a spare-time project together with some friends. What I would like to do is to have an spreadsheet saved on Google Drive (or similar services) that me and my friends will update regularly. The data from the spreadsheet we want to visualize using Python and Jupyter Notebooks. My friends are not into programming at all, so I want them to be able to access and run the notebooks in the cloud, e.g. through mybinder.org.

I did the credentials stuff from Google API, and it works fine when I run locally. The problem, however, is that since my understanding is that I should not upload credentials to GitHub, mybinder.org is not able to get the credentials that it needs to read the spreadsheet from Google Drive. So my question is how I can solve this?

One idea is to create a separate Google Account just for putting the spreadsheet there. If I do that then maybe uploading the credentials to GitHub is fine? The data from the spreadsheet is not sensitive at all.

tornhe
  • 1
  • Does the same apply for private github repo's, i know that github offers that as a service, but i'm unsure if it's still considered not a good idea to upload to private repos – oppressionslayer Nov 20 '19 at 20:35
  • @oppresionslayer. Private repos don't work with mybinder.org. See [here](https://stackoverflow.com/a/58206433/8508004). – Wayne Dec 12 '19 at 19:45

1 Answers1

1

You could set the file to be shared with those that have the link by selecting Get shareable link under 'Sharing' and then use the method described here to bring the file into an active Jupyter session. (More on the use of curl to do that is here.)
To have it be otained as CSV you can change the end of the URL of the shareable link from edit?usp=sharing to export?exportFormat=csv, based on here.
To execute curl in a Jupyter notebooks cell, you'd want to preface the command with an exclamation point so that the task is run in a shell.
Then direct the stdout to a file.
So combining that, the general form of the code cell would be:

!curl https://docs.google.com/spreadsheets/d/<specific_GUID_key>/export?exportFormat=csv > output.csv

Instead of running the code to retrieve it from a notebook cell, the command without the exclamation point could be placed in a start file so the current data is retrieved each time the session is spun up. See here for more about the start configuration file for use with Binderhubs/MyBinder.org.

You may also be interested in using Voila to have them see the visualizations via a dashboard backed by the Jupyter notebook. It is able to be spawned by sessions backed by MyBinder.org, too.

Wayne
  • 6,607
  • 8
  • 36
  • 93