sheets_id: 'sheets_id' class

Description Usage Arguments as_sheets_id() See Also Examples

Description

sheets_id is an S3 class that marks a string as a Google Sheet's id, which the Sheets API docs refer to as spreadsheetId.

Any object of class sheets_id also has the drive_id class, which is used by googledrive for the same purpose. This means you can provide a sheets_id to googledrive functions, in order to do anything with your Sheet that has nothing to do with it being a spreadsheet. Examples: change the Sheet's name, parent folder, or permissions. Read more about using googlesheets4 and googledrive together in vignette("drive-and-sheets"). Note that a sheets_id object is intended to hold just one id, while the parent class drive_id can be used for multiple ids.

as_sheets_id() is a generic function that converts various inputs into an instance of sheets_id. See more below.

When you print a sheets_id, we attempt to reveal the Sheet's current metadata, via gs4_get(). This can fail for a variety of reasons (e.g. if you're offline), but the input sheets_id is always revealed and returned, invisibly.

Usage

1

Arguments

x

Something that contains a Google Sheet id: an id string, a drive_id, a URL, a one-row dribble, or a googlesheets4_spreadsheet.

...

Other arguments passed down to methods. (Not used.)

as_sheets_id()

These inputs can be converted to a sheets_id:

See Also

googledrive::as_id

Examples

1
2
3
4
5
mini_gap_id <- gs4_example("mini-gap")
class(mini_gap_id)
mini_gap_id

as_sheets_id("abc")

googlesheets4 documentation built on July 22, 2021, 1:07 a.m.