0
votes

I could follow Wesley Chun to upload local csv file to a Team Drive alright as described in Managing Team Drives with Python and the Google Drive API, but it's not easy to append a csv file to a Google Sheet spreadsheet when both the csv file and the Google Sheet spreadsheet are in the same Team Drive. DriveApp.searchFiles(), getBlob().getDataAsString() and Utilities.parseCsv() work perfectly and get the job done in My Drive, but not in a Team Drive.

The challenge is to upload a local csv file to a Team Drive regularly; append the uploaded csv file to a Google Sheet spreadsheet in the same Team Drive. I got stuck at the second part. Do you have any clue?

1

1 Answers

0
votes

Are you able to get a shared file link for that uploaded CSV file in the team drive?

Right click on the file in the drive and click get shareable link. If you are able to do that it should look like this.

"https://drive.google.com/file/d/1Vd09if9o5wVL8lEGXE2QDaYhGMxzEFhj/view?usp=sharing"

Take your sheet_id code and paste it into the format below.

"https://drive.google.com/uc?export=download&id=1Vd09if9o5wVL8lEGXE2QDaYhGMxzEFhj"

You can then use =importdata("https://drive.google.com/uc?export=download&id=1Vd09if9o5wVL8lEGXE2QDaYhGMxzEFhj") in your sheet to pull in the data from the uploaded csv file.

Hopefully this helps.