correct way to output resource calendars to CSV file, keeping data in resourceId field intact

274 views
Skip to first unread message

Susan McClure

unread,
Mar 20, 2019, 4:27:56 PM3/20/19
to GAM for G Suite
I am having issues getting all my calendar resources into a .csv file with the proper data format for the "resourceId" field. 

Issue: if the resourceID for a calendar  is a "double negative number" it seems to SUM the data, Changing the resourceId data itself!  
For Example: if the actual ID = "-1981958-56"  the resourceId is populated with the SUM: "-1982014"

I am probably using the redirect to csv improperly. 
(FWIW - This is getting the download of all resources, so that I can create a  new.csv file to do bulk upload, to convert some resources to the newer structured format)

These are the 4 ways I have gotten the data, and if it works or not. 

  • Download to csv, via the Google Admin Console, Resources => Download your resources in a CSV file.  
It works and the resourceID field's data are all correct.       
  • Use "todrive" to create a Google Sheets doc and save as .csv 
cmd:  
C:\GAMADV-XTD>gam print resources allfields todrive tduser smc.....@..edu tdparent "GAM_Reports" tdtimestamp true tdhoursoffset 5 tdnoemail false


The cmd works, and the resulting Google Sheet has correct resourceId data.  And I can save the sheet and download it as a .csv. 
  • Use  redirect csv for cmd
cmd:   
C:\GAMADV-XTD>gam redirect csv ./AllResourcesViaPrintCmd.csv multiprocess print resources allfields  

The cmd works, but the csv file has incorrect data for those resourceId's that are a "double negative number"
  • Use a gam print command, redirecting to .csv file  
cmd:  
gam print resources allfields > AllResourcesPrintCmd.csv

The cmd works, but the resulting file when opened with Excel, has incorrect data for those resourceId's that are a "double negative number"

Am I doing it incorrectly, or is there something else going on with the commands that is changing the actual resourceId 's for some calendars?

I am using, on Windows:
C:\GAMADV-XTD>gam version
GAM
4.65.71 - https://github.com/taers232c/GAMADV-XTD
Ross Scroggs <ross.scroggs@gmail.com>
Python 2.7.15 64-bit final
google
-api-python-client 1.7.8
httplib2
0.12.1
auth2client
4.1.3
Windows-10-10.0.15063 AMD64
Path: C:\GAMADV-XTD



Thanks for any help or correction of my commands. 

Susan



Ross Scroggs

unread,
Mar 20, 2019, 5:16:11 PM3/20/19
to google-ap...@googlegroups.com
Susan,

This is an Excel issue, not a Gam issue. If you open the file with Wordpad for instance, you'll see the data is OK; The same is true with LibreOffice or OpenOffice.
If you tell Excel to show formulas, the cell will look like "=-1981958-56"; then format the column as text, not General or Number; then in that column only replace = with nothing.

Ross


--
You received this message because you are subscribed to the Google Groups "GAM for G Suite" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-man...@googlegroups.com.
To post to this group, send email to google-ap...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-manager.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-manager/76087997-a120-4294-86a1-316a6c245072%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--

Susan McClure

unread,
Mar 21, 2019, 1:42:07 PM3/21/19
to GAM for G Suite
Ross, 
Thank you so very much!  Yes that was it.  Shows my ignorance of Excel. 

May I a followup question, concerning a query against the resulting csv, pulling out just the records that match certain fields?

I would like to open the results file   AllResourcesViaPrintCmd.csv
and then search for any records where 
  name matches "*COB*"
OR
  description matches "*COB*"
and output just those resource records ( allfields )  to a NEW csv file - Resources_COB.csv

I can't get a query against the csv file to work. 

Thanks again,
Susan 
--

Ross Scroggs

unread,
Mar 21, 2019, 2:50:53 PM3/21/19
to google-ap...@googlegroups.com
Susan,

I taught myself some PowerShell:
Import-Csv -Path .\AllResourcesViaPrintCmd.csv | ? {$_.name -like "*COB*" -or $_.description -like "*COB*"} | Export-Csv .\Resources_COB.csv -NoTypeInformation

Ross
--
You received this message because you are subscribed to the Google Groups "GAM for G Suite" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-man...@googlegroups.com.
To post to this group, send email to google-ap...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-apps-manager.

For more options, visit https://groups.google.com/d/optout.


--

Susan McClure

unread,
Mar 22, 2019, 3:58:15 PM3/22/19
to GAM for G Suite

Ross,

Thanks! I learned a little powershell too.

Once I adjusted for the names of my column headers it worked like a Champ !

Import-Csv -Path .\AllResourcesViaPrintCmd.csv | ? {$_.resourceName -like "*COB*" -or $_.buildingName -like "*COB*"} | Export-Csv .\Resources_COB.csv -NoTypeInformation

 Now on to finding and sorting out all my resources to setup for updates!

Thanks again 

Susan 




Reply all
Reply to author
Forward
0 new messages