range_write: Write a 'data.frame' object to a review table hosted on...

View source: R/utils-sheets.R

range_writeR Documentation

Write a data.frame object to a review table hosted on Google Sheets

Description

[Experimental]

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

range_write() writes a data.frame object to a specific range of a review table hosted on Google Sheets.

This function was created as workaround to googlesheets4::range_write writing limit. It bypass this limit by writing in batches.

Please note that this function will always write in the A1 range and will delete all but the 2 first rows of the worksheet before writing on it.

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

Usage

range_write(x, name, package = rutils:::get_package_name(), limit = 2e+05)

Arguments

x

A data.frame object with at least 1 row.

name

A string indicating the name of the sheets that the function must write.

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).

limit

(optional) a number with the limit amount of data to write for each batch. Example: a limit of 200000 will write a data.frame with 10000 rows and 50 columns in 3 batches, because 10000 * 50 = 500000 (over the limit) and ceiling(500000 / 200000) = 3 (default: 200000).

See Also

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

Examples

## Not run: 
range_write(reference, "reference")
## End(Not run)

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