googlesheets (version 0.3.0)

gs_add_row: Append rows to a spreadsheet

Description

Add rows to an existing worksheet within an existing spreadsheet. This is based on the list feed, which has a strong assumption that the data occupies a neat rectangle in the upper left corner of the sheet. This function specifically uses this method, which "inserts the new row immediately after the last row that appears in the list feed, which is to say immediately before the first entirely blank row."

Usage

gs_add_row(ss, ws = 1, input = "", verbose = TRUE)

Arguments

ss

a registered Google spreadsheet, i.e. a googlesheet object

ws

positive integer or character string specifying index or title, respectively, of the worksheet

input

new cell values, as an object that can be coerced into a character vector, presumably an atomic vector, a factor, a matrix or a data.frame

verbose

logical; do you want informative messages?

Details

At the moment, this function will only work in a sheet that has a proper header row of variable or column names and at least one pre-existing data row. If you get Error : No matches, that suggests the worksheet doesn't meet these minimum requirements. In the future, we will try harder to populate the sheet as necessary, e.g. create default variable names in a header row and be able to cope with input being the first row of data.

If input is two-dimensional, internally we call gs_add_row once per input row.

See Also

gs_edit_cells

Examples

Run this code
# NOT RUN {
yo <- gs_copy(gs_gap(), to = "yo")
yo <- gs_add_row(yo, ws = "Oceania",
                 input = c("Valinor", "Aman", "2015", "10000",
                           "35", "1000.5"))
tail(gs_read(yo, ws = "Oceania"))

gs_delete(yo)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab