cell-specification: Specify cells for reading or writing

Description See Also Examples


If you aren't targetting all the cells in a worksheet, you can request that googlesheets limit a read or write operation to a specific rectangle of cells. Any function that offers this flexibility will have a range argument. The simplest usage is to specify an Excel-like cell range, such as range = "D12:F15" or range = "R1C12:R6C15". The cell rectangle can be specified in various other ways, using helper functions. In all cases, cell range processing is handled by the cellranger package, where you can find full documentation for the functions used in the examples below.

See Also

The cellranger package has full documentation on cell specification and offers additional functions for manipulating "A1:D10" style spreadsheet ranges. Here are the most relevant:

  • cell_limits

  • cell_rows

  • cell_cols

  • anchored

See a full list of functions in the cellranger index.


## Not run: 
gs_gap() %>% gs_read(ws = 2, range = "A1:D8")
gs_gap() %>% gs_read(ws = "Europe", range = cell_rows(1:4))
gs_gap() %>% gs_read(ws = "Europe", range = cell_rows(100:103),
                     col_names = FALSE)
gs_gap() %>% gs_read(ws = "Africa", range = cell_cols(1:4))
gs_gap() %>% gs_read(ws = "Asia", range = cell_limits(c(1, 5), c(4, NA)))

## End(Not run)

Search within the googlesheets package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.