range_write2: (Over)write new data into a range (v2)

Description Usage Arguments Value Examples

View source: R/range_write2.R

Description

This is a generic function that wraps around googlesheets4::range_write(). This variation is pipe-friendly because data argument has been swapped to the first argument. If the data is a named list of data.frame, each data.frame will be written to the corresponding sheets that its names were matched to the names of list of data.frame, but if any names of data was not found in sheet names, new sheets will have been created before the data.frame is written. If the data is a data.frame, it will simply pass to googlesheets4::range_write(), and If sheet can't be found in existing sheets, new sheet will be created, then data is written.

Usage

1
2
3
4
5
6
7
8
range_write2(
  data,
  ss,
  sheet = NULL,
  range = NULL,
  col_names = TRUE,
  reformat = FALSE
)

Arguments

data

A data frame or a named list of data frames

ss

Something that identifies a Google Sheet

sheet

(If data is a data frame) Sheet to write into, in the sense of "worksheet" or "tab". You can identify a sheet by name, with a string, or by position, with a number. Ignored if the sheet is specified via range. If neither argument specifies the sheet, defaults to the first visible sheet.

range

(If data is a data frame) Where to write. This range argument has important similarities and differences to range elsewhere (

col_names

Logical, indicates whether to send the column names of data.

reformat

Logical, indicates whether to reformat the affected cells. This default to FALSE meaning leaves prior formatting as is.

Value

The (list of) input ss, as an instance of sheets_id

Examples

1

Lightbridge-KS/lbapi documentation built on Dec. 17, 2021, 12:06 a.m.