read_sheet: Read the review tables hosted on Google Sheets

View source: R/utils-sheets.R

read_sheetR Documentation

Read the review tables hosted on Google Sheets

Description

[Experimental]

CAUTION: This function must be used only with packages that follow the sqlr system.

read_sheet() reads and returns the review tables hosted on Google Sheets.

You must have a sheets data object with the sheets metadata before running this function. See write_metadata() to learn more.

Usage

read_sheet(name = NULL, package = rutils:::get_package_name())

Arguments

name

(optional) A character object indicating the name or names of the sheets that the function must return (default: NULL).

package

(optional) a string indicating the package with the database data. If not assigned, the function will try to use the name of the active project directory (requires the rstudioapi package).

Value

  • If name = NULL, an invisible list object with tibbles objects of all entity sheet/tables available as elements, with the exception of the 'sheets', 'reference', and 'document' tables and any other non-entity tables.

  • If name have length > 1, an invisible list object with tibbles objects of sheet/tables indicated in name as elements.

  • If name have length == 1, an invisible tibble object of the sheet/table indicated in name.

See Also

Other Google Sheets functions: range_write(), sheet_nrow(), write_metadata(), write_query(), write_sheet()

Examples

## Not run: 
## To get a 'list' object with all the sheets

read_sheet()

## To get a 'list' object with some sheets

read_sheet(c(names(sheets)[2], names(sheets)[3]))

## To get a 'tibble' object of a specific sheet

read_sheet(names(sheets)[2])

## End(Not run)

gipsousp/sqlr documentation built on Sept. 29, 2023, 11:41 a.m.