Learn R Programming

googlesheets (version 0.2.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 data frame with one row per cell. Consult the Google Sheets API documentation for more details about https://developers.google.com/google-apps/spreadsheets/data#work_with_cell-based_feeds{the cell feed}.

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
...
Optional arguments to control data download, parsing, and reshaping; for most purposes, the defaults should be fine. Anything that is not listed here will be silently ignored. [object Object],[object Object],[object Object],[object Ob
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?

Value

  • a data.frame or, if dplyr is loaded, a tbl_df

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.

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
col_4_and_above <-
  gs_read_cellfeed(gap_ss, ws = "Asia", range = cell_limits(c(NA, 4)))
col_4_and_above
gs_reshape_cellfeed(col_4_and_above)

gs_read_cellfeed(gap_ss, range = "A2:F3")

Run the code above in your browser using DataLab