googlesheets (version 0.1.0)

gs_read_cellfeed: Read data from cells

Description

This function consumes data via the "cell feed", which, as the name suggests, retrieves data cell by cell. Note that the output is a tbl_df or data.frame with one row per cell.

Usage

gs_read_cellfeed(ss, ws = 1, range = NULL, return_empty = FALSE,
  return_links = FALSE, 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
range
a cell range, as described in cell-specification
return_empty
logical; indicates whether to return empty cells
return_links
logical; indicates whether to return the edit and self links (used internally in cell editing workflow)
verbose
logical; do you want informative messages?

Details

Use the range argument to specify which cells you want to read. See the examples and the help file for the cell specification functions for various ways to limit consumption to, e.g., a rectangle or certain columns. If range is specified, the associated cell limits will be checked for internal consistency and compliance with the known extent of the worksheet. If no limits are provided, all cells will be returned but consider that gs_read_csv and gs_read_listfeed are much faster ways to consume all the data from a rectangular worksheet.

Empty cells, even if "embedded" in a rectangular region of populated cells, are not normally returned by the cell feed. This function won't return them either when return_empty = FALSE (default), but will if you set return_empty = TRUE. If you don't specify any limits AND you set return_empty = TRUE, you could be in for a bit of a wait, as the feed will return all cells, which defaults to 1000 rows and 26 columns.

See Also

gs_reshape_cellfeed or gs_simplify_cellfeed to perform reshaping or simplification, respectively; gs_read is a pre-made wrapper that combines gs_read_cellfeed and gs_reshape_cellfeed

Other data.consumption.functions: gs_read_csv; gs_read_listfeed; gs_read; gs_reshape_cellfeed; gs_simplify_cellfeed

Examples

Run this code
gap_ss <- gs_gap() # register the Gapminder example sheet
first_4_rows <-
  gs_read_cellfeed(gap_ss, "Asia", range = cell_limits(c(NA, 4)))
first_4_rows
gs_reshape_cellfeed(first_4_rows)
gs_reshape_cellfeed(gs_read_cellfeed(gap_ss, "Asia",
                      range = cell_limits(c(NA, 4), c(3, NA))))

Run the code above in your browser using DataLab