Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

sheet_delete

Delete one or more (work)sheets


Description

Deletes one or more (work)sheets from a (spread)Sheet.

Usage

sheet_delete(ss, sheet)

Arguments

ss

Something that identifies a Google Sheet: its file ID, a URL from which we can recover the ID, an instance of googlesheets4_spreadsheet (returned by gs4_get()), or a dribble, which is how googledrive represents Drive files. Processed through as_sheets_id().

sheet

Sheet to delete, in the sense of "worksheet" or "tab". You can identify a sheet by name, with a string, or by position, with a number. You can pass a vector to delete multiple sheets at once or even a list, if you need to mix names and positions.

Value

The input ss, as an instance of sheets_id

See Also

Makes an DeleteSheetsRequest:

Examples

if (gs4_has_token()) {
  ss <- gs4_create("delete-sheets-from-me")
  sheet_add(ss, c("alpha", "beta", "gamma", "delta"))

  # get an overview of the sheets
  sheet_properties(ss)

  # delete sheets
  sheet_delete(ss, 1)
  sheet_delete(ss, "gamma")
  sheet_delete(ss, list("alpha", 2))

  # get an overview of the sheets
  sheet_properties(ss)

  # clean up
  gs4_find("delete-sheets-from-me") %>%
    googledrive::drive_trash()
}

googlesheets4

Access Google Sheets using the Sheets API V4

v0.3.0
MIT + file LICENSE
Authors
Jennifer Bryan [cre, aut] (<https://orcid.org/0000-0002-6983-2759>), RStudio [cph, fnd]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.