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.
sheet_append(ss, data, sheet =1)
Arguments
ss: Something that identifies a Google Sheet:
its file id as a string or drive_id
a URL from which we can recover the id
a one-row dribble, which is how googledrive represents Drive files
an instance of googlesheets4_spreadsheet, which is what gs4_get()
returns
Processed through as_sheets_id().
data: A data frame.
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.
Returns
The input ss, as an instance of sheets_id
Examples
# we will recreate the table of "other" deaths from this example Sheet(deaths <- gs4_example("deaths")%>% range_read(range ="other_data", col_types ="????DD"))# split the data into 3 pieces, which we will send separatelydeaths_one <- deaths[1:5,]deaths_two <- deaths[6,]deaths_three <- deaths[7:10,]# create a Sheet and send the first chunk of datass <- gs4_create("sheet-append-demo", sheets = list(deaths = deaths_one))# append a single rowss %>% sheet_append(deaths_two)# append remaining rowsss %>% sheet_append(deaths_three)# read and check against the originaldeaths_replica <- range_read(ss, col_types ="????DD")identical(deaths, deaths_replica)# clean upgs4_find("sheet-append-demo")%>% googledrive::drive_trash()