I am working on creating cloud functions to push data to Google AutoML. I have a function to create the data. For the next step, I am wondering. In a cloud function, is it possible to download a google sheets as a csv to a temp directory after data had populated it?
Asked
Active
Viewed 105 times
1 Answers
1
I believe it is possible. You can check this SO answer about :
Download google docs public spreadsheet to csv with python
import requests
response = requests.get('https://docs.google.com/spreadsheet/ccc?key=0ArM5yzzCw9IZdEdLWlpHT1FCcUpYQ2RjWmZYWmNwbXc&output=csv')
assert response.status_code == 200, 'Wrong status code'
print(response.content)
Then you can save the respose.content
to a file to /tmp
directory
Cloud Functions Execution Environment
The only writeable part of the filesystem is the /tmp directory, which you can use to store temporary files in a function instance. This is a local disk mount point known as a "tmpfs" volume in which data written to the volume is stored in memory. Note that it will consume memory resources provisioned for the function.
The rest of the file system is read-only and accessible to the function.

marian.vladoi
- 7,663
- 1
- 15
- 29