Adds one or more new rows after the last row with data in a (work)sheet, increasing the row dimension of the sheet if necessary.

sheets_append(data, ss, sheet = 1)

Arguments

data

A data frame.

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 sheets_get()), or a dribble, which is how googledrive represents Drive files. Processed through as_sheets_id().

sheet

Sheet to append to, in the sense of "worksheet" or "tab". You can identify a sheet by name, with a string, or by position, with a number.

Value

The input ss, as an instance of sheets_id

See also

Examples

if (sheets_has_token()) { # we will recreate the table of "other" deaths from this example Sheet (deaths <- sheets_example("deaths") %>% sheets_read(range = "other_data", col_types = "????DD")) # split the data into 3 pieces, which we will send separately deaths_one <- deaths[1:5, ] deaths_two <- deaths[6, ] deaths_three <- deaths[7:10, ] # create a Sheet and send the first chunk of data ss <- sheets_create("sheets-append-demo", sheets = list(deaths = deaths_one)) # append a single row sheets_append(deaths_two, ss) # append remaining rows sheets_append(deaths_three, ss) # read and check against the original deaths_replica <- sheets_read(ss, col_types = "????DD") identical(deaths, deaths_replica) # cleanup googledrive::drive_rm(ss) }
#> Reading from "deaths"
#> Range "other_data"
#> Creating new Sheet: "sheets-append-demo"
#> Writing to "sheets-append-demo"
#> Appending 1 row(s) to "deaths"
#> Writing to "sheets-append-demo"
#> Appending 4 row(s) to "deaths"
#> Reading from "sheets-append-demo"
#> Range "deaths"
#> Files deleted: #> * sheets-append-demo: 1GDIW9uN0eZlDP3sx-r2zbpNkeowgyp4EVyQLlNKD5iA