Skip to content

Command Data From Google Docs Sheets Storage

GitHub Action edited this page Oct 4, 2025 · 2 revisions

Command data from Google Docs, Sheets and Cloud Storage

Introduction

Google Sheets can be used in gam csv ... commands.

Google Docs and Sheets can be used to specify collections of data.

Google Docs and Drive Files can be used to specify notes, messages and signatures.

Definitions

Read data from a Google Doc or Drive File

<UserGoogleDoc> ::=
        <EmailAddress> <DriveFileIDEntity>|<DriveFileNameEntity>|(<SharedDriveEntity> <SharedDriveFileNameEntity>)
  • <EmailAddress> - The email address of a user with at least read access to the document

Use one of the following to specify the file:

  • <DriveFileIDEntity> - The ID of the file on a Drive or Shared Drive
  • <DriveFileNameEntity> - The name of the file
  • <SharedDriveEntity> <SharedDriveFileNameEntity> - A Shared Drive and the name of the file on that drive

Plain Text

Interpret a Google Doc as plain text or read a Drive file with MIME type text/plain.

gdoc <UserGoogleDoc>

HTML

Read a Drive file with MIME type text/html.

ghtml <UserGoogleDoc>

Read data from a Google Sheet

<SheetEntity> ::= <String>|id:<Number>

<UserGoogleSheet> ::=
        <EmailAddress> <DriveFileIDEntity>|<DriveFileNameEntity>|(<SharedDriveEntity> <SharedDriveFileNameEntity>) <SheetEntity>
  • <EmailAddress> - The email address of a user with at least read access to the document

Use one of the following to specify the file:

  • <DriveFileIDEntity> - The ID of the file on a Drive or Shared Drive
  • <DriveFileNameEntity> - The name of the file
  • <SharedDriveEntity> <SharedDriveFileNameEntity> - A Shared Drive and the name of the file on that drive

If a file name is specified, it must resolve to a single file ID; otherwise an error is generated.

If a Shared Drive name is specified, it must resolve to a single Shared Drive ID; otherwise an error is generated.

Select a sheet/tab from the Google Sheet with its ID or name; it is verified to exist within the Google Sheet.

Example:

gam csv gsheet [email protected] <DriveFileIDEntity> "Sheet 1" gam create user firstname "~FirstName" lastname "~lastName" email "~email"

Limited Service Account Access

If you want to disable a user's service account access to Drive and Sheets but still allow reading command data from Google Docs and Sheets, issue the following command and make these settings:

gam user [email protected] update serviceaccount

[ ] 20)  Drive API (supports readonly)
[*] 21)  Drive API - read command data
[ ] 42)  Sheets API (supports readonly)
[*] 43)  Sheets API - read command data

Read data from a Google Cloud Storage File

<StorageBucketName> ::= <String>
<StorageObjectName> ::= <String>
<StorageBucketObjectName> ::=
        https://storage.cloud.google.com/<StorageBucketName>/<StorageObjectName>|
        https://storage.googleapis.com/<StorageBucketName>/<StorageObjectName>|
        gs://<StorageBucketName>/<StorageObjectName>|
        <StorageBucketName>/<StorageObjectName>

CSV

Read a Google Cloud Storage file with contentType text/csv.

gcscsv <StorageBucketObjectName>

Plain Text

Read a Google Cloud Storage file with contentType text/plain.

gcsdoc <StorageBucketObjectName>

HTML

Read a Google Cloud Storage file with contentType text/html.

gcshtml <StorageBucketObjectName>

FAQ

Update History

Installation

Configuration

Notes and Information

Definitions

Command Processing

Collections

Client Access

Special Service Account Access

Service Account Access

Clone this wiki locally