Query syntax with csv gsheet varaible

13 views
Skip to first unread message

Joshua Squires

unread,
May 15, 2026, 3:41:07 PM (3 days ago) May 15
to GAM for Google Workspace
I am attempting to delete retired devices from the company owned devices section in the Admin Console. I have a large amount of devices so I am trying to delete them through GAM. I have a gsheet with a list of serial numbers. I am having issues using this with a gam command. 

After some trial and error I have found the correct format of the command to delete the records. Now I am attempting to delete them in bulk using the csv gsheet option. When I run the following it doesn't appear to be replacing the variable with the serial numbers. 

gam csv gsheet <us...@domain.com> <Document_ID> <Sheet_Name> gam delete device query "serial:~sn" doit

The output just shows the same two lines over and over again:

Getting all Devices that match query (serial:~sn), may take some time on a large Google Workspace Account...
Got 0 Devices...

I can confirm that the values I have for the user, Document_ID and sheet name are correct because if I remove "query "serial:" form the command and just leave ~sn the output shows the serial numbers. However it fails because it needs the query to work.  

Is it possible to include the variable in the query?


Ross Scroggs

unread,
May 15, 2026, 7:13:03 PM (3 days ago) May 15
to google-ap...@googlegroups.com
You want: gam csv gsheet <us...@domain.com> <Document_ID> <Sheet_Name> gam delete device query "serial:~~sn~~" doit

Ross
----
Ross Scroggs



--
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 visit https://groups.google.com/d/msgid/google-apps-manager/c54328f0-3ba6-4459-9757-db0d099e8f79n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages