Home > database >  How to upload a .csv file to GCP storage using Julia
How to upload a .csv file to GCP storage using Julia

Time:07-27

I want to write a .csv file in GCP storage directly from Julia.

CodePudding user response:

GoogleCloud.jl supports this functionality and all steps can be found in it's tutorial

I cite it here but look at the tutorial's version.

using GoogleCloud
creds = JSONCredentials("credentials.json")
session = GoogleSession(creds, ["devstorage.full_control"])
set_session!(storage, session)    # storage is the API root, exported from GoogleCloud.jl
file_contents = readstring(open("file.csv", "r"));
storage(:Object, :insert, "a12345foo";     # Returns metadata about the object
    name="file.csv", 
    data=file_contents,      
    content_type="text/csv" 
)
  • Related