Sample program to Upload a csv file to Google cloud Storage bucket

2,082 views
Skip to first unread message

Sagar Ganapaneni

unread,
Jul 9, 2014, 6:28:31 PM7/9/14
to google-a...@googlegroups.com

Hi, i have tried various examples available over the internet, but not successful in uploading a file to GSC bucket. I am able to read the files but not write.
Please share the sample programs if you any has one.

Jim

unread,
Jul 11, 2014, 3:15:42 PM7/11/14
to google-a...@googlegroups.com
what language are you using?

Vinny P

unread,
Jul 13, 2014, 12:01:26 AM7/13/14
to google-a...@googlegroups.com
On Wed, Jul 9, 2014 at 5:28 PM, Sagar Ganapaneni <12sag...@gmail.com> wrote:
i have tried various examples available over the internet, but not successful in uploading a file to GSC bucket. I am able to read the files but not write. Please share the sample programs if you any has one


Do you need the parse or otherwise read the text of the CSV file (for instance, creating datastore entities out of the CSV data), or do you need to just upload a CSV file to GCS?

If you just need to upload a CSV file, use the blobstore API and target GCS as the storage service: https://developers.google.com/appengine/docs/python/blobstore/#Python_Using_the_Blobstore_API_with_Google_Cloud_StorageThe example code presented on that page will upload any file, including CSV files. 

If you need to upload and interpret the CSV file, that changes things. You can reuse the uploader code above, then read it in and use a standard library to interpret the CSV text: https://docs.python.org/2/library/csv.html (there are similar libraries available for other languages).

 
-----------------
-Vinny P
Technology & Media Consultant
Chicago, IL

App Engine Code Samples: http://www.learntogoogleit.com

Reply all
Reply to author
Forward
0 new messages