Skip to content

Todrive

Ross Scroggs edited this page Sep 5, 2019 · 57 revisions

Todrive

Introduction

Gam print commands allow the results to be uploaded to Google Drive instead of being saved locally. By default, Gam titles the uploaded file: "Domain Name - Data Type"; Data Type describes the data being uploaded, e.g. Groups, Orgs, Users. It is uploaded to the root folder of the admin user named in oauth2.txt.

You can modify the default todrive behavior with options in gam.cfg or on the command line.

Config file options

You can specify most todrive options in gam.cfg.

todrive_clientaccess
        Enable/disable use of client access rather than service account access when uploading files with todrive
        Default: False
todrive_conversion
        Enable/disable conversion of CSV files to Google Sheets when todrive is specified
        Default: True
todrive_localcopy
        Enable/disable saving a local copy of CSV files when todrive is specified
        Default: False
todrive_nobrowser
        Enable/disable opening a browser when todrive is specified
        Default: False
todrive_noemail
        Enable/disable sending an email when todrive is specified
        Default: True
todrive_parent
        Parent folder for CSV files when todrive is specified;
        can be id:<DriveFolderID> or <DriveFolderName>
        Default: root
todrive_timestamp
        Enable/disable adding a timestamp to the title of CSV files when todrive is specified
        Default: False
todrive_user
        Email address of user to receive CSV files when todrive is specified
        Default: '' which becomes admin user in oauth2.txt

Command line options

Anywhere you can specify todrive, there are additional subarguments following the todrive argument that let you title the file, add a description, specify the sheet name, direct the uploaded file to a particular user and location and add a timestamp to the file title.

<ToDriveAttribute> ::=
        (tddescription <String>)|
        (tdlocalcopy [<Boolean>])|
        (tdnobrowser [<Boolean>])|
        (tdnoemail [<Boolean>])
        (tdparent id:<DriveFolderID>|<DriveFolderName>)|(tdfileid <DriveFileID>)
        (tdsheet <String>)|
        (tdtimestamp [<Boolean>] [tddaysoffset <Number>] [tdhoursoffset <Number])
        (tdtitle <String>)|
        (tduser <EmailAddress>)|
  • tddescription - The description for the uploaded file, if not specified, the command line that created the file is used.
  • tdlocalcopy - Should a local copy of the CSV file be saved in addition to the file uploaded to Google Drive; if not specified, the todrive_localcopy value from gam.cfg is used.
  • tdnobrowser - If False, a browser is opened to view the file uploaded to Google Drive; if not specified, the todrive_nobrowser value from gam.cfg is used.
  • tdnoemail - If False, an email is sent to tduser informing them of name and URL of the uploaded file; if not specified, the todrive_noemail value from gam.cfg is used.
  • tdparent - An existing/writable parent folder for the uploaded file; if not specified, the todrive_parent value from gam.cfg is used; that value defaults to the root folder.
  • tdfileid - An existing/writable file for the uploaded file; it takes precedence over tdparent.
  • tdsheet - The sheet name for the uploaded file if it is uploaded as a Google Sheet, if not specified, the tdtitle is used.
  • tdtimestamp - Should a timestamp (of the time the file is uploaded to Google) be added to the title of the uploaded file; if not specified, the todrive_timestamp value from gam.cfg is used, that value defaults to False.
  • tddaysoffset and tdhoursoffset - Values that subtract time from the timestamp, they default to 0. A possible use for these values is as documentation to reflect the end of the time period that the uploaded report covers.
  • tdtitle - The title for the uploaded file, if not specified, the Gam default title is used.
  • tduser - The user to receive the uploaded file; if not specified, the todrive_user value from gam.cfg is used; that value defaults to the user named in oauth2.txt.

Example

Generate a list of user IDs and names, title the file "User IDs and Names", upload it to the "GAM Reports" folder of usermgr@domain.com, add a timestamp to the title.

gam print users todrive tdtitle "User IDs and Names" tduser usermgr@domain.com tdparent "GAM Reports" tdtimestamp true id name

Update History

Installation

Configuration

Notes and Information

Definitions

Command Processing

Collections

Client Access

Special Service Account Access

Service Account Access

Clone this wiki locally