uploading a csv to a new tab in an existing sheet

312 views
Skip to first unread message

Temple Rodgers

unread,
Aug 18, 2021, 11:05:35 AM8/18/21
to GAM for Google Workspace
another step along the road. I'm actually doing a bulk update to many sheets with individual csv's, but I can't get the actual GAM syntax correct one line at a time. I tried this:
gam user fr...@domain.com update drivefile 1234xxxxxxxxxxxxxxxxxxxxxxxxxxxXYZ csvsheet id:sheet2 localfile newdata.csv

I've tried various permutations using todrive and tdfileid tdaddsheet but haven't quite got it right .. I'll bet it's something simple!

Maj Marshall Giguere

unread,
Aug 18, 2021, 1:29:30 PM8/18/21
to google-ap...@googlegroups.com
Have you tried
> gam user <user id> update drivefile id < sheets file id > retainname localfile ./csvFilename.csv gsheet "<sheet name>"


Maj Marshall E. Giguere, CAP
NH Wing Director of IT
U.S. Air Force Auxiliary
 


Disclaimers apply, for full details see: https://hackney.gov.uk/email-disclaimer


--
You received this message because you are subscribed to the Google Groups "GAM for Google Workspace" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-man...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/9738bee5-2487-450e-8c84-c784abc3316dn%40googlegroups.com.

Ross Scroggs

unread,
Aug 18, 2021, 3:04:34 PM8/18/21
to google-ap...@googlegroups.com
Temple/Marsh,

THis will update an existing sheet:
gam user <user id> update drivefile id < sheets file id > retainname localfile ./csvFilename.csv gsheet "<sheet name>"

This will add a new sheet:
gam user <user id> update drivefile id < sheets file id > retainname localfile ./csvFilename.csv addsheet "<sheet name>"

Scroll down a bit

Ross



--

Temple Rodgers

unread,
Aug 18, 2021, 3:07:45 PM8/18/21
to GAM for Google Workspace
thank you @marsh and @ross - I'm on the case. Will report back with results.

Temple Rodgers

unread,
Aug 18, 2021, 3:43:17 PM8/18/21
to GAM for Google Workspace
MURPHY'S LAW!!!
I'm suddenly getting quota exceeded .. thank you @ross for handling this :)
but it works quite nicely ... maybe there's a way of adding two csv's at once?

So, this is what I'm doing - 
  • I've run a modified version of GetSharedWithAnyoneDriveACLs.py - I added a column with the webViewLink for the file to the output csv, so that a user will be able to go directly to the file when I've uploaded it to the gsheet
  • I've got two sets of csv files, one for publicontheweb (aka id:anyone) and one for anyonewithlink (aka id:anyoneWithLink) which I upload to a single sheet for each user using gam csv
  • Firstly - 
gam csv ./publicontheweb.csv gam user fr...@domain.com create drivefile localfile ~localfilename drive filename ~filename mimetype gsheet parentid 1234xxxxxxxxxxxxxxxxxxxxxxxxxxxXYZ
  • then I take the file id's output when the new gsheets are created and put them into the csv input for the next gam command
gam csv ./gamupdatesheets.csv gam user fr...@domain.com update drivefile id ~drivefileid retainname localfile ~localfilename addsheet "With Link"

Reply all
Reply to author
Forward
0 new messages