Using gspread to export csv to shared folder

21 views Asked by At

I want to export a csv from my Google colab code using pandas to a shared folder. Following the solution given in this question, the export to My Drive works fine. However, simply extending it to export the file to a shared folder gives me errors.

I tried the following code. I expected the folder to be added to the Shared folder, but I got an error stating that the folder doesn't exist.

Example code:

import pandas as pd
import gspread
from google.auth import default
creds, _ = default()

gc = gspread.authorize(creds)

df=pd.DataFrame({1:[1,2,3]})
df.to_csv('/drive/Shared with me/folder_name/bla.csv')
0

There are 0 answers