Specify cells for reading or writing

Description

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.

Examples

1
2
3
4
5
6
7
8
9
## 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)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.