googlesheets4/ 0000755 0001762 0000144 00000000000 14441243302 013023 5 ustar ligges users googlesheets4/NAMESPACE 0000644 0001762 0000144 00000011301 14440453710 014243 0 ustar ligges users # Generated by roxygen2: do not edit by hand
S3method(as_CellData,"NULL")
S3method(as_CellData,Date)
S3method(as_CellData,POSIXct)
S3method(as_CellData,character)
S3method(as_CellData,default)
S3method(as_CellData,factor)
S3method(as_CellData,googlesheets4_formula)
S3method(as_CellData,googlesheets4_schema_CellData)
S3method(as_CellData,list)
S3method(as_CellData,logical)
S3method(as_CellData,numeric)
S3method(as_GridCoordinate,default)
S3method(as_GridCoordinate,range_spec)
S3method(as_GridRange,default)
S3method(as_GridRange,range_spec)
S3method(as_NamedRange,default)
S3method(as_NamedRange,range_spec)
S3method(as_Sheet,"NULL")
S3method(as_Sheet,character)
S3method(as_Sheet,data.frame)
S3method(as_Sheet,default)
S3method(as_id,googlesheets4_spreadsheet)
S3method(as_id,sheets_id)
S3method(as_range_spec,"NULL")
S3method(as_range_spec,cell_limits)
S3method(as_range_spec,character)
S3method(as_range_spec,default)
S3method(as_sheets_id,"NULL")
S3method(as_sheets_id,character)
S3method(as_sheets_id,default)
S3method(as_sheets_id,dribble)
S3method(as_sheets_id,drive_id)
S3method(as_sheets_id,googlesheets4_spreadsheet)
S3method(as_sheets_id,sheets_id)
S3method(as_tibble,googlesheets4_schema_GridRange)
S3method(as_tibble,googlesheets4_schema_NamedRange)
S3method(as_tibble,googlesheets4_schema_ProtectedRange)
S3method(as_tibble,googlesheets4_schema_Sheet)
S3method(as_tibble,googlesheets4_schema_SheetProperties)
S3method(ctype,"NULL")
S3method(ctype,SHEETS_CELL)
S3method(ctype,character)
S3method(ctype,default)
S3method(ctype,list)
S3method(format,googlesheets4_spreadsheet)
S3method(format,range_spec)
S3method(format,sheets_id)
S3method(patch,default)
S3method(patch,googlesheets4_schema)
S3method(print,googlesheets4_spreadsheet)
S3method(print,range_spec)
S3method(print,sheets_id)
S3method(vec_cast,character.sheets_id)
S3method(vec_cast,drive_id.sheets_id)
S3method(vec_cast,googlesheets4_formula)
S3method(vec_cast,sheets_id.character)
S3method(vec_cast,sheets_id.drive_id)
S3method(vec_cast,sheets_id.sheets_id)
S3method(vec_cast.character,googlesheets4_formula)
S3method(vec_cast.googlesheets4_formula,character)
S3method(vec_cast.googlesheets4_formula,default)
S3method(vec_cast.googlesheets4_formula,googlesheets4_formula)
S3method(vec_ptype2,character.sheets_id)
S3method(vec_ptype2,drive_id.sheets_id)
S3method(vec_ptype2,googlesheets4_formula)
S3method(vec_ptype2,sheets_id.character)
S3method(vec_ptype2,sheets_id.drive_id)
S3method(vec_ptype2,sheets_id.sheets_id)
S3method(vec_ptype2.character,googlesheets4_formula)
S3method(vec_ptype2.googlesheets4_formula,character)
S3method(vec_ptype2.googlesheets4_formula,default)
S3method(vec_ptype2.googlesheets4_formula,googlesheets4_formula)
S3method(vec_ptype_abbr,googlesheets4_formula)
S3method(vec_ptype_abbr,sheets_id)
export("%>%")
export(anchored)
export(as_sheets_id)
export(cell_cols)
export(cell_limits)
export(cell_rows)
export(gs4_api_key)
export(gs4_auth)
export(gs4_auth_configure)
export(gs4_browse)
export(gs4_create)
export(gs4_deauth)
export(gs4_endpoints)
export(gs4_example)
export(gs4_examples)
export(gs4_find)
export(gs4_fodder)
export(gs4_formula)
export(gs4_get)
export(gs4_has_token)
export(gs4_oauth_app)
export(gs4_oauth_client)
export(gs4_random)
export(gs4_scopes)
export(gs4_token)
export(gs4_user)
export(local_gs4_quiet)
export(range_autofit)
export(range_clear)
export(range_delete)
export(range_flood)
export(range_read)
export(range_read_cells)
export(range_speedread)
export(range_write)
export(read_sheet)
export(request_generate)
export(request_make)
export(sheet_add)
export(sheet_append)
export(sheet_copy)
export(sheet_delete)
export(sheet_names)
export(sheet_properties)
export(sheet_relocate)
export(sheet_rename)
export(sheet_resize)
export(sheet_write)
export(spread_sheet)
export(vec_cast.googlesheets4_formula)
export(vec_ptype2.googlesheets4_formula)
export(with_gs4_quiet)
export(write_sheet)
import(rlang)
import(vctrs)
importFrom(cellranger,anchored)
importFrom(cellranger,cell_cols)
importFrom(cellranger,cell_limits)
importFrom(cellranger,cell_rows)
importFrom(gargle,bulletize)
importFrom(gargle,gargle_map_cli)
importFrom(glue,glue)
importFrom(glue,glue_collapse)
importFrom(glue,glue_data)
importFrom(googledrive,as_id)
importFrom(lifecycle,deprecated)
importFrom(magrittr,"%>%")
importFrom(methods,setOldClass)
importFrom(purrr,"%||%")
importFrom(purrr,compact)
importFrom(purrr,discard)
importFrom(purrr,imap)
importFrom(purrr,keep)
importFrom(purrr,map)
importFrom(purrr,map2)
importFrom(purrr,map_chr)
importFrom(purrr,map_dbl)
importFrom(purrr,map_int)
importFrom(purrr,map_lgl)
importFrom(purrr,modify_if)
importFrom(purrr,pluck)
importFrom(purrr,pmap)
importFrom(purrr,pmap_chr)
importFrom(purrr,transpose)
importFrom(purrr,walk)
importFrom(tibble,as_tibble)
googlesheets4/LICENSE 0000644 0001762 0000144 00000000063 14406646454 014047 0 ustar ligges users YEAR: 2023
COPYRIGHT HOLDER: googlesheets4 authors
googlesheets4/README.md 0000644 0001762 0000144 00000024706 14440460716 014324 0 ustar ligges users
# googlesheets4
[](https://CRAN.R-project.org/package=googlesheets4)
[](https://github.com/tidyverse/googlesheets4/actions/workflows/R-CMD-check.yaml)
[](https://app.codecov.io/gh/tidyverse/googlesheets4?branch=main)
## Overview
googlesheets4 provides an R interface to [Google
Sheets](https://docs.google.com/spreadsheets/) via the [Sheets API
v4](https://developers.google.com/sheets/api/). It is a reboot of an
earlier package called
[googlesheets](https://github.com/jennybc/googlesheets#readme).
*Why **4**? Why googlesheets**4**? Did I miss googlesheets1 through 3?
No. The idea is to name the package after the corresponding version of
the Sheets API. In hindsight, the original googlesheets should have been
googlesheets**3**.*
## Installation
You can install the released version of googlesheets4 from
[CRAN](https://CRAN.R-project.org) with:
``` r
install.packages("googlesheets4")
```
And the development version from [GitHub](https://github.com/) with:
``` r
#install.packages("pak")
pak::pak("tidyverse/googlesheets4")
```
## Cheatsheet
You can see how to read data with googlesheets4 in the **data import
cheatsheet**, which also covers similar functionality in the related
packages readr and readxl.
## Auth
googlesheets4 will, by default, help you interact with Sheets as an
authenticated Google user. If you don’t plan to write Sheets or to read
private Sheets, use `gs4_deauth()` to indicate there is no need for a
token. See the article [googlesheets4
auth](https://googlesheets4.tidyverse.org/articles/articles/auth.html)
for more.
For this overview, we’ve logged into Google as a specific user in a
hidden chunk.
## Attach googlesheets4
``` r
library(googlesheets4)
```
## Read
The main “read” function of the googlesheets4 package goes by two names,
because we want it to make sense in two contexts:
- `read_sheet()` evokes other table-reading functions, like
`readr::read_csv()` and `readxl::read_excel()`. The `sheet` in this
case refers to a Google (spread)Sheet.
- `range_read()` is the right name according to the [naming
convention](https://googlesheets4.tidyverse.org/articles/articles/function-class-names.html)
used throughout the googlesheets4 package.
`read_sheet()` and `range_read()` are synonyms and you can use either
one. Here we’ll use `read_sheet()`.
googlesheets4 is [pipe-friendly](https://r4ds.had.co.nz/pipes.html) (and
reexports `%>%`), but works just fine without the pipe.
Read from
- a URL
- a Sheet ID
- a
[`dribble`](https://googledrive.tidyverse.org/reference/dribble.html)
produced by the googledrive package, which can lookup by file name
These all achieve the same thing:
``` r
# URL
read_sheet("https://docs.google.com/spreadsheets/d/1U6Cf_qEOhiR9AZqTqS3mbMF3zt2db48ZP5v3rkrAEJY/edit#gid=780868077")
#> ✔ Reading from "gapminder".
#> ✔ Range 'Africa'.
#> # A tibble: 624 × 6
#> country continent year lifeExp pop gdpPercap
#>
#> 1 Algeria Africa 1952 43.1 9279525 2449.
#> 2 Algeria Africa 1957 45.7 10270856 3014.
#> 3 Algeria Africa 1962 48.3 11000948 2551.
#> 4 Algeria Africa 1967 51.4 12760499 3247.
#> 5 Algeria Africa 1972 54.5 14760787 4183.
#> # ℹ 619 more rows
# Sheet ID
read_sheet("1U6Cf_qEOhiR9AZqTqS3mbMF3zt2db48ZP5v3rkrAEJY")
#> ✔ Reading from "gapminder".
#> ✔ Range 'Africa'.
#> # A tibble: 624 × 6
#> country continent year lifeExp pop gdpPercap
#>
#> 1 Algeria Africa 1952 43.1 9279525 2449.
#> 2 Algeria Africa 1957 45.7 10270856 3014.
#> 3 Algeria Africa 1962 48.3 11000948 2551.
#> 4 Algeria Africa 1967 51.4 12760499 3247.
#> 5 Algeria Africa 1972 54.5 14760787 4183.
#> # ℹ 619 more rows
# a googledrive "dribble"
googledrive::drive_get("gapminder") %>%
read_sheet()
#> ✔ The input `path` resolved to exactly 1 file.
#> ✔ Reading from "gapminder".
#> ✔ Range 'Africa'.
#> # A tibble: 624 × 6
#> country continent year lifeExp pop gdpPercap
#>
#> 1 Algeria Africa 1952 43.1 9279525 2449.
#> 2 Algeria Africa 1957 45.7 10270856 3014.
#> 3 Algeria Africa 1962 48.3 11000948 2551.
#> 4 Algeria Africa 1967 51.4 12760499 3247.
#> 5 Algeria Africa 1972 54.5 14760787 4183.
#> # ℹ 619 more rows
```
*Note: the only reason we can read a sheet named “gapminder” (the last
example) is because the account we’re logged in as has a Sheet named
“gapminder”.*
See the article [Find and Identify
Sheets](https://googlesheets4.tidyverse.org/articles/articles/find-identify-sheets.html)
for more about specifying the Sheet you want to address. See the article
[Read
Sheets](https://googlesheets4.tidyverse.org/articles/articles/find-identify-sheets.html)
for more about reading from specific sheets or ranges, setting column
type, and getting low-level cell data.
## Write
`gs4_create()` creates a brand new Google Sheet and can optionally send
some initial data.
``` r
(ss <- gs4_create("fluffy-bunny", sheets = list(flowers = head(iris))))
#> ✔ Creating new Sheet: "fluffy-bunny".
#>
#> ── ─────────────────────────────────────────────────
#> Spreadsheet name: "fluffy-bunny"
#> ID: 1enILX4tYJeFEJ1RL8MsGgDRjb0NHTdm3ZD92R2RMWYI
#> Locale: en_US
#> Time zone: Etc/GMT
#> # of sheets: 1
#>
#> ── ────────────────────────────────────────────────────────────────────
#> (Sheet name): (Nominal extent in rows x columns)
#> 'flowers': 7 x 5
```
`sheet_write()` (over)writes a whole data frame into a (work)sheet
within a (spread)Sheet.
``` r
head(mtcars) %>%
sheet_write(ss, sheet = "autos")
#> ✔ Writing to "fluffy-bunny".
#> ✔ Writing to sheet 'autos'.
ss
#>
#> ── ─────────────────────────────────────────────────
#> Spreadsheet name: "fluffy-bunny"
#> ID: 1enILX4tYJeFEJ1RL8MsGgDRjb0NHTdm3ZD92R2RMWYI
#> Locale: en_US
#> Time zone: Etc/GMT
#> # of sheets: 2
#>
#> ── ────────────────────────────────────────────────────────────────────
#> (Sheet name): (Nominal extent in rows x columns)
#> 'flowers': 7 x 5
#> 'autos': 7 x 11
```
`sheet_append()`, `range_write()`, `range_flood()`, and `range_clear()`
are more specialized writing functions. See the article [Write
Sheets](https://googlesheets4.tidyverse.org/articles/articles/write-sheets.html)
for more about writing to Sheets.
## Where to learn more
[Get
started](https://googlesheets4.tidyverse.org/articles/googlesheets4.html)
is a more extensive general introduction to googlesheets4.
Browse the [articles
index](https://googlesheets4.tidyverse.org/articles/index.html) to find
articles that cover various topics in more depth.
See the [function
index](https://googlesheets4.tidyverse.org/reference/index.html) for an
organized, exhaustive listing.
## Contributing
If you’d like to contribute to the development of googlesheets4, please
read [these
guidelines](https://googlesheets4.tidyverse.org/CONTRIBUTING.html).
Please note that the googlesheets4 project is released with a
[Contributor Code of
Conduct](https://googlesheets4.tidyverse.org/CODE_OF_CONDUCT.html). By
contributing to this project, you agree to abide by its terms.
## Privacy
[Privacy policy](https://www.tidyverse.org/google_privacy_policy)
## Context
googlesheets4 draws on and complements / emulates other packages in the
tidyverse:
- [googlesheets](https://cran.r-project.org/package=googlesheets) is the
package that googlesheets4 replaces. Main improvements in
googlesheets4: (1) wraps the current, most modern Sheets API; (2)
leaves all “whole file” operations to googledrive; and (3) uses shared
infrastructure for auth and more, from the gargle package. The v3 API
wrapped by googlesheets is deprecated. [Starting in April/May
2020](https://workspace.google.com/blog/product-announcements/migrate-your-apps-use-latest-sheets-api),
features will gradually be disabled and it’s anticipated the API will
fully shutdown in September 2020. At that point, the original
googlesheets package must be retired.
- [googledrive](https://googledrive.tidyverse.org) provides a
fully-featured interface to the Google Drive API. Any “whole file”
operations can be accomplished with googledrive: upload or download or
update a spreadsheet, copy, rename, move, change permission, delete,
etc. googledrive supports Team Drives.
- [readxl](https://readxl.tidyverse.org) is the tidyverse package for
reading Excel files (xls or xlsx) into an R data frame. googlesheets4
takes cues from parts of the readxl interface, especially around
specifying which cells to read.
- [readr](https://readr.tidyverse.org) is the tidyverse package for
reading delimited files (e.g., csv or tsv) into an R data frame.
googlesheets4 takes cues from readr with respect to column type
specification.
googlesheets4/man/ 0000755 0001762 0000144 00000000000 14440453710 013603 5 ustar ligges users googlesheets4/man/gs4_token.Rd 0000644 0001762 0000144 00000002333 14275601106 015770 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/gs4_auth.R
\name{gs4_token}
\alias{gs4_token}
\title{Produce configured token}
\usage{
gs4_token()
}
\value{
A \code{request} object (an S3 class provided by \link[httr:httr-package]{httr}).
}
\description{
For internal use or for those programming around the Sheets API.
Returns a token pre-processed with \code{\link[httr:config]{httr::config()}}. Most users
do not need to handle tokens "by hand" or, even if they need some
control, \code{\link[=gs4_auth]{gs4_auth()}} is what they need. If there is no current
token, \code{\link[=gs4_auth]{gs4_auth()}} is called to either load from cache or
initiate OAuth2.0 flow.
If auth has been deactivated via \code{\link[=gs4_deauth]{gs4_deauth()}}, \code{gs4_token()}
returns \code{NULL}.
}
\examples{
\dontshow{if (gs4_has_token()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
req <- request_generate(
"sheets.spreadsheets.get",
list(spreadsheetId = "abc"),
token = gs4_token()
)
req
\dontshow{\}) # examplesIf}
}
\seealso{
Other low-level API functions:
\code{\link{gs4_has_token}()},
\code{\link{request_generate}()},
\code{\link{request_make}()}
}
\concept{low-level API functions}
googlesheets4/man/gs4_deauth.Rd 0000644 0001762 0000144 00000002326 14440453710 016124 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/gs4_auth.R
\name{gs4_deauth}
\alias{gs4_deauth}
\title{Suspend authorization}
\usage{
gs4_deauth()
}
\description{
Put googlesheets4 into a de-authorized state. Instead of sending a token,
googlesheets4 will send an API key. This can be used to access public
resources for which no Google sign-in is required. This is handy for using
googlesheets4 in a non-interactive setting to make requests that do not
require a token. It will prevent the attempt to obtain a token
interactively in the browser. The user can configure their own API key
via \code{\link[=gs4_auth_configure]{gs4_auth_configure()}} and retrieve that key via
\code{\link[=gs4_api_key]{gs4_api_key()}}.
In the absence of a user-configured key, a built-in default key is used.
}
\examples{
\dontshow{if (rlang::is_interactive()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
gs4_deauth()
gs4_user()
# get metadata on the public 'deaths' spreadsheet
gs4_example("deaths") \%>\%
gs4_get()
\dontshow{\}) # examplesIf}
}
\seealso{
Other auth functions:
\code{\link{gs4_auth_configure}()},
\code{\link{gs4_auth}()},
\code{\link{gs4_scopes}()}
}
\concept{auth functions}
googlesheets4/man/sheet_properties.Rd 0000644 0001762 0000144 00000002754 14406646454 017501 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sheet_properties.R
\name{sheet_properties}
\alias{sheet_properties}
\alias{sheet_names}
\title{Get data about (work)sheets}
\usage{
sheet_properties(ss)
sheet_names(ss)
}
\arguments{
\item{ss}{Something that identifies a Google Sheet:
\itemize{
\item its file id as a string or \code{\link[googledrive:drive_id]{drive_id}}
\item a URL from which we can recover the id
\item a one-row \code{\link[googledrive:dribble]{dribble}}, which is how googledrive
represents Drive files
\item an instance of \code{googlesheets4_spreadsheet}, which is what \code{\link[=gs4_get]{gs4_get()}}
returns
}
Processed through \code{\link[=as_sheets_id]{as_sheets_id()}}.}
}
\value{
\itemize{
\item \code{sheet_properties()}: A tibble with one row per (work)sheet.
\item \code{sheet_names()}: A character vector of (work)sheet names.
}
}
\description{
Reveals full metadata or just the names for the (work)sheets inside a
(spread)Sheet.
}
\examples{
\dontshow{if (gs4_has_token()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
ss <- gs4_example("gapminder")
sheet_properties(ss)
sheet_names(ss)
\dontshow{\}) # examplesIf}
}
\seealso{
Other worksheet functions:
\code{\link{sheet_add}()},
\code{\link{sheet_append}()},
\code{\link{sheet_copy}()},
\code{\link{sheet_delete}()},
\code{\link{sheet_relocate}()},
\code{\link{sheet_rename}()},
\code{\link{sheet_resize}()},
\code{\link{sheet_write}()}
}
\concept{worksheet functions}
googlesheets4/man/gs4_oauth_app.Rd 0000644 0001762 0000144 00000001222 14407071424 016625 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/gs4_auth.R
\name{gs4_oauth_app}
\alias{gs4_oauth_app}
\title{Get currently configured OAuth app (deprecated)}
\usage{
gs4_oauth_app()
}
\description{
\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}}
In light of the new \code{\link[gargle:gargle_oauth_client_from_json]{gargle::gargle_oauth_client()}} constructor and class of
the same name, \code{gs4_oauth_app()} is being replaced by
\code{\link[=gs4_oauth_client]{gs4_oauth_client()}}.
}
\keyword{internal}
googlesheets4/man/sheet_append.Rd 0000644 0001762 0000144 00000005206 14406646454 016547 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sheet_append.R
\name{sheet_append}
\alias{sheet_append}
\title{Append rows to a sheet}
\usage{
sheet_append(ss, data, sheet = 1)
}
\arguments{
\item{ss}{Something that identifies a Google Sheet:
\itemize{
\item its file id as a string or \code{\link[googledrive:drive_id]{drive_id}}
\item a URL from which we can recover the id
\item a one-row \code{\link[googledrive:dribble]{dribble}}, which is how googledrive
represents Drive files
\item an instance of \code{googlesheets4_spreadsheet}, which is what \code{\link[=gs4_get]{gs4_get()}}
returns
}
Processed through \code{\link[=as_sheets_id]{as_sheets_id()}}.}
\item{data}{A data frame.}
\item{sheet}{Sheet to append to, in the sense of "worksheet" or "tab". You can identify a sheet by name, with a string, or by position, with a number.}
}
\value{
The input \code{ss}, as an instance of \code{\link{sheets_id}}
}
\description{
Adds one or more new rows after the last row with data in a (work)sheet,
increasing the row dimension of the sheet if necessary.
}
\examples{
\dontshow{if (gs4_has_token()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
# we will recreate the table of "other" deaths from this example Sheet
(deaths <- gs4_example("deaths") \%>\%
range_read(range = "other_data", col_types = "????DD"))
# split the data into 3 pieces, which we will send separately
deaths_one <- deaths[1:5, ]
deaths_two <- deaths[6, ]
deaths_three <- deaths[7:10, ]
# create a Sheet and send the first chunk of data
ss <- gs4_create("sheet-append-demo", sheets = list(deaths = deaths_one))
# append a single row
ss \%>\% sheet_append(deaths_two)
# append remaining rows
ss \%>\% sheet_append(deaths_three)
# read and check against the original
deaths_replica <- range_read(ss, col_types = "????DD")
identical(deaths, deaths_replica)
# clean up
gs4_find("sheet-append-demo") \%>\%
googledrive::drive_trash()
\dontshow{\}) # examplesIf}
}
\seealso{
Makes an \code{AppendCellsRequest}:
\itemize{
\item \url{https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#AppendCellsRequest}
}
Other write functions:
\code{\link{gs4_create}()},
\code{\link{gs4_formula}()},
\code{\link{range_delete}()},
\code{\link{range_flood}()},
\code{\link{range_write}()},
\code{\link{sheet_write}()}
Other worksheet functions:
\code{\link{sheet_add}()},
\code{\link{sheet_copy}()},
\code{\link{sheet_delete}()},
\code{\link{sheet_properties}()},
\code{\link{sheet_relocate}()},
\code{\link{sheet_rename}()},
\code{\link{sheet_resize}()},
\code{\link{sheet_write}()}
}
\concept{worksheet functions}
\concept{write functions}
googlesheets4/man/googlesheets4-package.Rd 0000644 0001762 0000144 00000002343 14406646454 020254 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/googlesheets4-package.R
\docType{package}
\name{googlesheets4-package}
\alias{googlesheets4}
\alias{googlesheets4-package}
\title{googlesheets4: Access Google Sheets using the Sheets API V4}
\description{
\if{html}{\figure{logo.png}{options: style='float: right' alt='logo' width='120'}}
Interact with Google Sheets through the Sheets API v4 \url{https://developers.google.com/sheets/api}. "API" is an acronym for "application programming interface"; the Sheets API allows users to interact with Google Sheets programmatically, instead of via a web browser. The "v4" refers to the fact that the Sheets API is currently at version 4. This package can read and write both the metadata and the cell data in a Sheet.
}
\seealso{
Useful links:
\itemize{
\item \url{https://googlesheets4.tidyverse.org}
\item \url{https://github.com/tidyverse/googlesheets4}
\item Report bugs at \url{https://github.com/tidyverse/googlesheets4/issues}
}
}
\author{
\strong{Maintainer}: Jennifer Bryan \email{jenny@posit.co} (\href{https://orcid.org/0000-0002-6983-2759}{ORCID})
Other contributors:
\itemize{
\item Posit Software, PBC [copyright holder, funder]
}
}
\keyword{internal}
googlesheets4/man/gs4_auth_configure.Rd 0000644 0001762 0000144 00000006026 14440453710 017655 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/gs4_auth.R
\name{gs4_auth_configure}
\alias{gs4_auth_configure}
\alias{gs4_api_key}
\alias{gs4_oauth_client}
\title{Edit and view auth configuration}
\usage{
gs4_auth_configure(client, path, api_key, app = deprecated())
gs4_api_key()
gs4_oauth_client()
}
\arguments{
\item{client}{A Google OAuth client, presumably constructed via
\code{\link[gargle:gargle_oauth_client_from_json]{gargle::gargle_oauth_client_from_json()}}. Note, however, that it is
preferred to specify the client with JSON, using the \code{path} argument.}
\item{path}{JSON downloaded from \href{https://console.cloud.google.com}{Google Cloud Console}, containing a client id and
secret, in one of the forms supported for the \code{txt} argument of
\code{\link[jsonlite:fromJSON]{jsonlite::fromJSON()}} (typically, a file path or JSON string).}
\item{api_key}{API key.}
\item{app}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Replaced by the \code{client}
argument.}
}
\value{
\itemize{
\item \code{gs4_auth_configure()}: An object of R6 class
\link[gargle:AuthState-class]{gargle::AuthState}, invisibly.
\item \code{gs4_oauth_client()}: the current user-configured OAuth client.
\item \code{gs4_api_key()}: the current user-configured API key.
}
}
\description{
These functions give more control over and visibility into the auth
configuration than \code{\link[=gs4_auth]{gs4_auth()}} does. \code{gs4_auth_configure()}
lets the user specify their own:
\itemize{
\item OAuth client, which is used when obtaining a user token.
\item API key. If googlesheets4 is de-authorized via \code{\link[=gs4_deauth]{gs4_deauth()}}, all
requests are sent with an API key in lieu of a token.
}
See the \code{vignette("get-api-credentials", package = "gargle")}
for more.
If the user does not configure these settings, internal defaults
are used.
\code{gs4_oauth_client()} and \code{gs4_api_key()} retrieve the
currently configured OAuth client and API key, respectively.
}
\examples{
# see and store the current user-configured OAuth client (probably `NULL`)
(original_client <- gs4_oauth_client())
# see and store the current user-configured API key (probably `NULL`)
(original_api_key <- gs4_api_key())
# the preferred way to configure your own client is via a JSON file
# downloaded from Google Developers Console
# this example JSON is indicative, but fake
path_to_json <- system.file(
"extdata", "client_secret_installed.googleusercontent.com.json",
package = "gargle"
)
gs4_auth_configure(path = path_to_json)
# this is also obviously a fake API key
gs4_auth_configure(api_key = "the_key_I_got_for_a_google_API")
# confirm the changes
gs4_oauth_client()
gs4_api_key()
# restore original auth config
gs4_auth_configure(client = original_client, api_key = original_api_key)
}
\seealso{
Other auth functions:
\code{\link{gs4_auth}()},
\code{\link{gs4_deauth}()},
\code{\link{gs4_scopes}()}
}
\concept{auth functions}
googlesheets4/man/range_speedread.Rd 0000644 0001762 0000144 00000010051 14406646454 017212 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/range_speedread.R
\name{range_speedread}
\alias{range_speedread}
\title{Read Sheet as CSV}
\usage{
range_speedread(ss, sheet = NULL, range = NULL, skip = 0, ...)
}
\arguments{
\item{ss}{Something that identifies a Google Sheet:
\itemize{
\item its file id as a string or \code{\link[googledrive:drive_id]{drive_id}}
\item a URL from which we can recover the id
\item a one-row \code{\link[googledrive:dribble]{dribble}}, which is how googledrive
represents Drive files
\item an instance of \code{googlesheets4_spreadsheet}, which is what \code{\link[=gs4_get]{gs4_get()}}
returns
}
Processed through \code{\link[=as_sheets_id]{as_sheets_id()}}.}
\item{sheet}{Sheet to read, 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 \code{range}. If neither argument specifies the sheet, defaults to the first visible sheet.}
\item{range}{A cell range to read from. If \code{NULL}, all non-empty cells are
read. Otherwise specify \code{range} as described in \href{https://developers.google.com/sheets/api/guides/concepts#a1_notation}{Sheets A1 notation}
or using the helpers documented in \link{cell-specification}. Sheets uses
fairly standard spreadsheet range notation, although a bit different from
Excel. Examples of valid ranges: \code{"Sheet1!A1:B2"}, \code{"Sheet1!A:A"},
\code{"Sheet1!1:2"}, \code{"Sheet1!A5:A"}, \code{"A1:B2"}, \code{"Sheet1"}. Interpreted
strictly, even if the range forces the inclusion of leading, trailing, or
embedded empty rows or columns. Takes precedence over \code{skip}, \code{n_max} and
\code{sheet}. Note \code{range} can be a named range, like \code{"sales_data"}, without
any cell reference.}
\item{skip}{Minimum number of rows to skip before reading anything, be it
column names or data. Leading empty rows are automatically skipped, so this
is a lower bound. Ignored if \code{range} is given.}
\item{...}{Passed along to the CSV parsing function (currently
\code{readr::read_csv()}).}
}
\value{
A \link[tibble:tibble-package]{tibble}
}
\description{
This function uses a quick-and-dirty method to read a Sheet that bypasses the
Sheets API and, instead, parses a CSV representation of the data. This can be
much faster than \code{\link[=range_read]{range_read()}} -- noticeably so for "large" spreadsheets.
There are real downsides, though, so we recommend this approach only when the
speed difference justifies it. Here are the limitations we must accept to get
faster reading:
\itemize{
\item Only formatted cell values are available, not underlying values or details
on the formats.
\item We can't target a named range as the \code{range}.
\item We have no access to the data type of a cell, i.e. we don't know that it's
logical, numeric, or datetime. That must be re-discovered based on the
CSV data (or specified by the user).
\item Auth and error handling have to be handled a bit differently internally,
which may lead to behaviour that differs from other functions in
googlesheets4.
}
Note that the Sheets API is still used to retrieve metadata on the target
Sheet, in order to support range specification. \code{range_speedread()} also
sends an auth token with the request, unless a previous call to
\code{\link[=gs4_deauth]{gs4_deauth()}} has put googlesheets4 into a de-authorized state.
}
\examples{
\dontshow{if (gs4_has_token()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
if (require("readr")) {
# since cell type is not available, use readr's col type specification
range_speedread(
gs4_example("deaths"),
sheet = "other",
range = "A5:F15",
col_types = cols(
Age = col_integer(),
`Date of birth` = col_date("\%m/\%d/\%Y"),
`Date of death` = col_date("\%m/\%d/\%Y")
)
)
}
# write a Sheet that, by default, is NOT world-readable
(ss <- sheet_write(chickwts))
# demo that range_speedread() sends a token, which is why we can read this
range_speedread(ss)
# clean up
googledrive::drive_trash(ss)
\dontshow{\}) # examplesIf}
}
googlesheets4/man/gs4_user.Rd 0000644 0001762 0000144 00000001153 14074074641 015632 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/gs4_auth.R
\name{gs4_user}
\alias{gs4_user}
\title{Get info on current user}
\usage{
gs4_user()
}
\value{
An email address or, if no token has been loaded, \code{NULL}.
}
\description{
Reveals the email address of the user associated with the current token.
If no token has been loaded yet, this function does not initiate auth.
}
\examples{
gs4_user()
}
\seealso{
\code{\link[gargle:token-info]{gargle::token_userinfo()}}, \code{\link[gargle:token-info]{gargle::token_email()}},
\code{\link[gargle:token-info]{gargle::token_tokeninfo()}}
}
googlesheets4/man/googlesheets4-vctrs.Rd 0000644 0001762 0000144 00000000715 14074074641 020015 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/googlesheets4-package.R, R/gs4_formula.R
\name{googlesheets4-vctrs}
\alias{googlesheets4-vctrs}
\alias{vec_ptype2.googlesheets4_formula}
\alias{vec_cast.googlesheets4_formula}
\title{Internal vctrs methods}
\usage{
\method{vec_ptype2}{googlesheets4_formula}(x, y, ...)
\method{vec_cast}{googlesheets4_formula}(x, to, ...)
}
\description{
Internal vctrs methods
}
\keyword{internal}
googlesheets4/man/range_delete.Rd 0000644 0001762 0000144 00000006455 14406646454 016535 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/range_delete.R
\name{range_delete}
\alias{range_delete}
\title{Delete cells}
\usage{
range_delete(ss, sheet = NULL, range, shift = NULL)
}
\arguments{
\item{ss}{Something that identifies a Google Sheet:
\itemize{
\item its file id as a string or \code{\link[googledrive:drive_id]{drive_id}}
\item a URL from which we can recover the id
\item a one-row \code{\link[googledrive:dribble]{dribble}}, which is how googledrive
represents Drive files
\item an instance of \code{googlesheets4_spreadsheet}, which is what \code{\link[=gs4_get]{gs4_get()}}
returns
}
Processed through \code{\link[=as_sheets_id]{as_sheets_id()}}.}
\item{sheet}{Sheet to delete, 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 \code{range}. If neither argument specifies the sheet, defaults to the first visible sheet.}
\item{range}{Cells to delete. There are a couple differences between \code{range}
here and how it works in other functions (e.g. \code{\link[=range_read]{range_read()}}):
\itemize{
\item \code{range} must be specified.
\item \code{range} must not be a named range.
\item \code{range} must not be the name of a (work) sheet. Instead, use
\code{\link[=sheet_delete]{sheet_delete()}} to delete an entire sheet.
Row-only and column-only ranges are especially relevant, such as "2:6" or
"D". Remember you can also use the helpers in \code{\link{cell-specification}},
such as \code{cell_cols(4:6)}, or \code{cell_rows(5)}.
}}
\item{shift}{Must be one of "up" or "left", if specified. Required if \code{range}
is NOT a rows-only or column-only range (in which case, we can figure it
out for you). Determines whether the deleted area is filled by shifting
surrounding cells up or to the left.}
}
\value{
The input \code{ss}, as an instance of \code{\link{sheets_id}}
}
\description{
Deletes a range of cells and shifts other cells into the deleted area. There
are several related tasks that are implemented by other functions:
\itemize{
\item To clear cells of their value and/or format, use \code{\link[=range_clear]{range_clear()}}.
\item To delete an entire (work)sheet, use \code{\link[=sheet_delete]{sheet_delete()}}.
\item To change the dimensions of a (work)sheet, use \code{\link[=sheet_resize]{sheet_resize()}}.
}
}
\examples{
\dontshow{if (gs4_has_token()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
# create a data frame to use as initial data
df <- gs4_fodder(10)
# create Sheet
ss <- gs4_create("range-delete-example", sheets = list(df))
# delete some rows
range_delete(ss, range = "2:4")
# delete a column
range_delete(ss, range = "C")
# delete a rectangle and specify how to shift remaining cells
range_delete(ss, range = "B3:F4", shift = "left")
# clean up
gs4_find("range-delete-example") \%>\%
googledrive::drive_trash()
\dontshow{\}) # examplesIf}
}
\seealso{
Makes a \code{DeleteRangeRequest}:
\itemize{
\item \url{https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#DeleteRangeRequest}
}
Other write functions:
\code{\link{gs4_create}()},
\code{\link{gs4_formula}()},
\code{\link{range_flood}()},
\code{\link{range_write}()},
\code{\link{sheet_append}()},
\code{\link{sheet_write}()}
}
\concept{write functions}
googlesheets4/man/sheet_rename.Rd 0000644 0001762 0000144 00000003746 14406646454 016556 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sheet_rename.R
\name{sheet_rename}
\alias{sheet_rename}
\title{Rename a (work)sheet}
\usage{
sheet_rename(ss, sheet = NULL, new_name)
}
\arguments{
\item{ss}{Something that identifies a Google Sheet:
\itemize{
\item its file id as a string or \code{\link[googledrive:drive_id]{drive_id}}
\item a URL from which we can recover the id
\item a one-row \code{\link[googledrive:dribble]{dribble}}, which is how googledrive
represents Drive files
\item an instance of \code{googlesheets4_spreadsheet}, which is what \code{\link[=gs4_get]{gs4_get()}}
returns
}
Processed through \code{\link[=as_sheets_id]{as_sheets_id()}}.}
\item{sheet}{Sheet to rename, in the sense of "worksheet" or "tab". You can identify a sheet by name, with a string, or by position, with a number. Defaults to the first visible sheet.}
\item{new_name}{New name of the sheet, as a string. This is required.}
}
\value{
The input \code{ss}, as an instance of \code{\link{sheets_id}}
}
\description{
Changes the name of a (work)sheet.
}
\examples{
\dontshow{if (gs4_has_token()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
ss <- gs4_create(
"sheet-rename-demo",
sheets = list(cars = head(cars), chickwts = head(chickwts))
)
sheet_names(ss)
ss \%>\%
sheet_rename(1, new_name = "automobiles") \%>\%
sheet_rename("chickwts", new_name = "poultry")
# clean up
gs4_find("sheet-rename-demo") \%>\%
googledrive::drive_trash()
\dontshow{\}) # examplesIf}
}
\seealso{
Makes an \code{UpdateSheetPropertiesRequest}:
\itemize{
\item \url{https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#UpdateSheetPropertiesRequest}
}
Other worksheet functions:
\code{\link{sheet_add}()},
\code{\link{sheet_append}()},
\code{\link{sheet_copy}()},
\code{\link{sheet_delete}()},
\code{\link{sheet_properties}()},
\code{\link{sheet_relocate}()},
\code{\link{sheet_resize}()},
\code{\link{sheet_write}()}
}
\concept{worksheet functions}
googlesheets4/man/range_write.Rd 0000644 0001762 0000144 00000013515 14406646454 016420 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/range_write.R
\name{range_write}
\alias{range_write}
\title{(Over)write new data into a range}
\usage{
range_write(
ss,
data,
sheet = NULL,
range = NULL,
col_names = TRUE,
reformat = TRUE
)
}
\arguments{
\item{ss}{Something that identifies a Google Sheet:
\itemize{
\item its file id as a string or \code{\link[googledrive:drive_id]{drive_id}}
\item a URL from which we can recover the id
\item a one-row \code{\link[googledrive:dribble]{dribble}}, which is how googledrive
represents Drive files
\item an instance of \code{googlesheets4_spreadsheet}, which is what \code{\link[=gs4_get]{gs4_get()}}
returns
}
Processed through \code{\link[=as_sheets_id]{as_sheets_id()}}.}
\item{data}{A data frame.}
\item{sheet}{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 \code{range}. If neither argument specifies the sheet, defaults to the first visible sheet.}
\item{range}{Where to write. This \code{range} argument has important similarities
and differences to \code{range} elsewhere (e.g. \code{\link[=range_read]{range_read()}}):
\itemize{
\item Similarities: Can be a cell range, using A1 notation ("A1:D3") or using
the helpers in \code{\link{cell-specification}}. Can combine sheet name and cell
range ("Sheet1!A5:A") or refer to a sheet by name (\code{range = "Sheet1"},
although \code{sheet = "Sheet1"} is preferred for clarity).
\item Difference: Can NOT be a named range.
\item Difference: \code{range} can be interpreted as the \emph{start} of the target
rectangle (the upper left corner) or, more literally, as the actual
target rectangle. See the "Range specification" section for details.
}}
\item{col_names}{Logical, indicates whether to send the column names of
\code{data}.}
\item{reformat}{Logical, indicates whether to reformat the affected cells.
Currently googlesheets4 provides no real support for formatting, so
\code{reformat = TRUE} effectively means that edited cells become unformatted.}
}
\value{
The input \code{ss}, as an instance of \code{\link{sheets_id}}
}
\description{
Writes a data frame into a range of cells. Main differences from
\code{\link[=sheet_write]{sheet_write()}} (a.k.a. \code{\link[=write_sheet]{write_sheet()}}):
\itemize{
\item Narrower scope. \code{range_write()} literally targets some cells, not a whole
(work)sheet.
\item The edited rectangle is not explicitly styled as a table. Nothing special
is done re: formatting a header row or freezing rows.
\item Column names can be suppressed. This means that, although \code{data} must
be a data frame (at least for now), \code{range_write()} can actually be used
to write arbitrary data.
\item The target (spread)Sheet and (work)sheet must already exist. There is no
ability to create a Sheet or add a worksheet.
\item The target sheet dimensions are not "trimmed" to shrink-wrap the \code{data}.
However, the sheet might gain rows and/or columns, in order to write
\code{data} to the user-specified \code{range}.
}
If you just want to add rows to an existing table, the function you probably
want is \code{\link[=sheet_append]{sheet_append()}}.
}
\section{Range specification}{
The \code{range} argument of \code{range_write()} is special, because the Sheets API
can implement it in 2 different ways:
\itemize{
\item If \code{range} represents exactly 1 cell, like "B3", it is taken as the \emph{start}
(or upper left corner) of the targeted cell rectangle. The edited cells are
determined implicitly by the extent of the \code{data} we are writing. This
frees you from doing fiddly range computations based on the dimensions of
the \code{data}.
\item If \code{range} describes a rectangle with multiple cells, it is interpreted
as the \emph{actual} rectangle to edit. It is possible to describe a rectangle
that is unbounded on the right (e.g. "B2:4"), on the bottom (e.g. "A4:C"),
or on both the right and the bottom (e.g.
\code{cell_limits(c(2, 3), c(NA, NA))}. Note that \strong{all cells} inside the
rectangle receive updated data and format. Important implication: if the
\code{data} object isn't big enough to fill the target rectangle, the cells that
don't receive new data are effectively cleared, i.e. the existing value
and format are deleted.
}
}
\examples{
\dontshow{if (gs4_has_token()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
# create a Sheet with some initial, empty (work)sheets
(ss <- gs4_create("range-write-demo", sheets = c("alpha", "beta")))
df <- data.frame(
x = 1:3,
y = letters[1:3]
)
# write df somewhere other than the "upper left corner"
range_write(ss, data = df, range = "D6")
# view your magnificent creation in the browser
gs4_browse(ss)
# send data of disparate types to a 1-row rectangle
dat <- tibble::tibble(
string = "string",
logical = TRUE,
datetime = Sys.time()
)
range_write(ss, data = dat, sheet = "beta", col_names = FALSE)
# send data of disparate types to a 1-column rectangle
dat <- tibble::tibble(
x = list(Sys.time(), FALSE, "string")
)
range_write(ss, data = dat, range = "beta!C5", col_names = FALSE)
# clean up
gs4_find("range-write-demo") \%>\%
googledrive::drive_trash()
\dontshow{\}) # examplesIf}
}
\seealso{
If sheet size needs to change, makes an \code{UpdateSheetPropertiesRequest}:
\itemize{
\item \url{https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#UpdateSheetPropertiesRequest}
}
The main data write is done via an \code{UpdateCellsRequest}:
\itemize{
\item \url{https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#updatecellsrequest}
}
Other write functions:
\code{\link{gs4_create}()},
\code{\link{gs4_formula}()},
\code{\link{range_delete}()},
\code{\link{range_flood}()},
\code{\link{sheet_append}()},
\code{\link{sheet_write}()}
}
\concept{write functions}
googlesheets4/man/gs4_formula.Rd 0000644 0001762 0000144 00000003561 14275601106 016321 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/gs4_formula.R
\name{gs4_formula}
\alias{gs4_formula}
\title{Class for Google Sheets formulas}
\usage{
gs4_formula(x = character())
}
\arguments{
\item{x}{Character.}
}
\value{
An S3 vector of class \code{googlesheets4_formula}.
}
\description{
In order to write a formula into Google Sheets, you need to store it as an
object of class \code{googlesheets4_formula}. This is how we distinguish a
"regular" character string from a string that should be interpreted as a
formula. \code{googlesheets4_formula} is an S3 class implemented using the \href{https://vctrs.r-lib.org/articles/s3-vector.html}{vctrs package}.
}
\examples{
\dontshow{if (gs4_has_token()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
dat <- data.frame(x = c(1, 5, 3, 2, 4, 6))
ss <- gs4_create("gs4-formula-demo", sheets = dat)
ss
summaries <- tibble::tribble(
~desc, ~summaries,
"max", "=max(A:A)",
"sum", "=sum(A:A)",
"min", "=min(A:A)",
"sparkline", "=SPARKLINE(A:A, {\"color\", \"blue\"})"
)
# explicitly declare a column as `googlesheets4_formula`
summaries$summaries <- gs4_formula(summaries$summaries)
summaries
range_write(ss, data = summaries, range = "C1", reformat = FALSE)
miscellany <- tibble::tribble(
~desc, ~example,
"hyperlink", "=HYPERLINK(\"http://www.google.com/\",\"Google\")",
"image", "=IMAGE(\"https://www.google.com/images/srpr/logo3w.png\")"
)
miscellany$example <- gs4_formula(miscellany$example)
miscellany
sheet_write(miscellany, ss = ss)
# clean up
gs4_find("gs4-formula-demo") \%>\%
googledrive::drive_trash()
\dontshow{\}) # examplesIf}
}
\seealso{
Other write functions:
\code{\link{gs4_create}()},
\code{\link{range_delete}()},
\code{\link{range_flood}()},
\code{\link{range_write}()},
\code{\link{sheet_append}()},
\code{\link{sheet_write}()}
}
\concept{write functions}
googlesheets4/man/sheet_add.Rd 0000644 0001762 0000144 00000005601 14406646454 016027 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sheet_add.R
\name{sheet_add}
\alias{sheet_add}
\title{Add one or more (work)sheets}
\usage{
sheet_add(ss, sheet = NULL, ..., .before = NULL, .after = NULL)
}
\arguments{
\item{ss}{Something that identifies a Google Sheet:
\itemize{
\item its file id as a string or \code{\link[googledrive:drive_id]{drive_id}}
\item a URL from which we can recover the id
\item a one-row \code{\link[googledrive:dribble]{dribble}}, which is how googledrive
represents Drive files
\item an instance of \code{googlesheets4_spreadsheet}, which is what \code{\link[=gs4_get]{gs4_get()}}
returns
}
Processed through \code{\link[=as_sheets_id]{as_sheets_id()}}.}
\item{sheet}{One or more new sheet names. If unspecified, one new sheet is
added and Sheets autogenerates a name of the form "SheetN".}
\item{...}{Optional parameters to specify additional properties, common to
all of the new sheet(s). Not relevant to most users. Specify fields of the
\href{https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/sheets#SheetProperties}{\code{SheetProperties} schema}
in \code{name = value} form.}
\item{.before, .after}{Optional specification of where to put the new sheet(s). Specify, at most, one of \code{.before} and \code{.after}. Refer to an existing sheet by name (via a string) or by position (via a number). If unspecified, Sheets puts the new sheet(s) at the end.}
}
\value{
The input \code{ss}, as an instance of \code{\link{sheets_id}}
}
\description{
Adds one or more (work)sheets to an existing (spread)Sheet. Note that sheet
names must be unique.
}
\examples{
\dontshow{if (gs4_has_token()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
ss <- gs4_create("add-sheets-to-me")
# the only required argument is the target spreadsheet
ss \%>\% sheet_add()
# but you CAN specify sheet name and/or position
ss \%>\% sheet_add("apple", .after = 1)
ss \%>\% sheet_add("banana", .after = "apple")
# add multiple sheets at once
ss \%>\% sheet_add(c("coconut", "dragonfruit"))
# keeners can even specify additional sheet properties
ss \%>\%
sheet_add(
sheet = "eggplant",
.before = 1,
gridProperties = list(
rowCount = 3, columnCount = 6, frozenRowCount = 1
)
)
# get an overview of the sheets
sheet_properties(ss)
# clean up
gs4_find("add-sheets-to-me") \%>\%
googledrive::drive_trash()
\dontshow{\}) # examplesIf}
}
\seealso{
Makes a batch of \code{AddSheetRequest}s (one per sheet):
\itemize{
\item \url{https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#addsheetrequest}
}
Other worksheet functions:
\code{\link{sheet_append}()},
\code{\link{sheet_copy}()},
\code{\link{sheet_delete}()},
\code{\link{sheet_properties}()},
\code{\link{sheet_relocate}()},
\code{\link{sheet_rename}()},
\code{\link{sheet_resize}()},
\code{\link{sheet_write}()}
}
\concept{worksheet functions}
googlesheets4/man/gs4_fodder.Rd 0000644 0001762 0000144 00000001641 14074074641 016121 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/gs4_fodder.R
\name{gs4_fodder}
\alias{gs4_fodder}
\title{Create useful spreadsheet filler}
\usage{
gs4_fodder(n = 10, m = n)
}
\arguments{
\item{n}{Number of rows.}
\item{m}{Number of columns.}
}
\value{
A data frame of character vectors.
}
\description{
Creates a data frame that is useful for filling a spreadsheet, when you just
need a sheet to experiment with. The data frame has \code{n} rows and \code{m} columns
with these properties:
\itemize{
\item Column names match what Sheets displays: "A", "B", "C", and so on.
\item Inner cell values reflect the coordinates where each value will land in
the sheet, in A1-notation. So the first row is "B2", "C2", and so on.
Note that this \code{n}-row data frame will occupy \code{n + 1} rows in the sheet,
because the column names occupy the first row.
}
}
\examples{
gs4_fodder()
gs4_fodder(5, 3)
}
googlesheets4/man/sheet_delete.Rd 0000644 0001762 0000144 00000004056 14406646454 016544 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sheet_delete.R
\name{sheet_delete}
\alias{sheet_delete}
\title{Delete one or more (work)sheets}
\usage{
sheet_delete(ss, sheet)
}
\arguments{
\item{ss}{Something that identifies a Google Sheet:
\itemize{
\item its file id as a string or \code{\link[googledrive:drive_id]{drive_id}}
\item a URL from which we can recover the id
\item a one-row \code{\link[googledrive:dribble]{dribble}}, which is how googledrive
represents Drive files
\item an instance of \code{googlesheets4_spreadsheet}, which is what \code{\link[=gs4_get]{gs4_get()}}
returns
}
Processed through \code{\link[=as_sheets_id]{as_sheets_id()}}.}
\item{sheet}{Sheet to delete, in the sense of "worksheet" or "tab". You can identify a sheet by name, with a string, or by position, with a number. You can pass a vector to delete multiple sheets at once or even a list, if you need to mix names and positions.}
}
\value{
The input \code{ss}, as an instance of \code{\link{sheets_id}}
}
\description{
Deletes one or more (work)sheets from a (spread)Sheet.
}
\examples{
\dontshow{if (gs4_has_token()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
ss <- gs4_create("delete-sheets-from-me")
sheet_add(ss, c("alpha", "beta", "gamma", "delta"))
# get an overview of the sheets
sheet_properties(ss)
# delete sheets
sheet_delete(ss, 1)
sheet_delete(ss, "gamma")
sheet_delete(ss, list("alpha", 2))
# get an overview of the sheets
sheet_properties(ss)
# clean up
gs4_find("delete-sheets-from-me") \%>\%
googledrive::drive_trash()
\dontshow{\}) # examplesIf}
}
\seealso{
Makes an \code{DeleteSheetsRequest}:
\itemize{
\item \url{https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/request#DeleteSheetRequest}
}
Other worksheet functions:
\code{\link{sheet_add}()},
\code{\link{sheet_append}()},
\code{\link{sheet_copy}()},
\code{\link{sheet_properties}()},
\code{\link{sheet_relocate}()},
\code{\link{sheet_rename}()},
\code{\link{sheet_resize}()},
\code{\link{sheet_write}()}
}
\concept{worksheet functions}
googlesheets4/man/roxygen/ 0000755 0001762 0000144 00000000000 13635427346 015311 5 ustar ligges users googlesheets4/man/roxygen/templates/ 0000755 0001762 0000144 00000000000 13643533245 017302 5 ustar ligges users googlesheets4/man/roxygen/templates/ss-return.R 0000644 0001762 0000144 00000000073 13635427346 021374 0 ustar ligges users #' @return The input `ss`, as an instance of [`sheets_id`]
googlesheets4/man/roxygen/templates/range.R 0000644 0001762 0000144 00000001422 13635427346 020525 0 ustar ligges users #' @param range A cell range to read from. If `NULL`, all non-empty cells are
#' read. Otherwise specify `range` as described in [Sheets A1
#' notation](https://developers.google.com/sheets/api/guides/concepts#a1_notation)
#' or using the helpers documented in [cell-specification]. Sheets uses
#' fairly standard spreadsheet range notation, although a bit different from
#' Excel. Examples of valid ranges: `"Sheet1!A1:B2"`, `"Sheet1!A:A"`,
#' `"Sheet1!1:2"`, `"Sheet1!A5:A"`, `"A1:B2"`, `"Sheet1"`. Interpreted
#' strictly, even if the range forces the inclusion of leading, trailing, or
#' embedded empty rows or columns. Takes precedence over `skip`, `n_max` and
#' `sheet`. Note `range` can be a named range, like `"sales_data"`, without
#' any cell reference.
googlesheets4/man/roxygen/templates/reformat.R 0000644 0001762 0000144 00000000346 13640673130 021242 0 ustar ligges users #' @param reformat Logical, indicates whether to reformat the affected cells.
#' Currently googlesheets4 provides no real support for formatting, so
#' `reformat = TRUE` effectively means that edited cells become unformatted.
googlesheets4/man/roxygen/templates/skip-read.R 0000644 0001762 0000144 00000000322 13635427346 021306 0 ustar ligges users #' @param skip Minimum number of rows to skip before reading anything, be it
#' column names or data. Leading empty rows are automatically skipped, so this
#' is a lower bound. Ignored if `range` is given.
googlesheets4/man/roxygen/templates/n_max.R 0000644 0001762 0000144 00000000544 13635427346 020537 0 ustar ligges users #' @param n_max Maximum number of data rows to parse into the returned tibble.
#' Trailing empty rows are automatically skipped, so this is an upper bound on
#' the number of rows in the result. Ignored if `range` is given. `n_max` is
#' imposed locally, after reading all non-empty cells, so, if speed is an
#' issue, it is better to use `range`.
googlesheets4/man/sheets_id.Rd 0000644 0001762 0000144 00000006226 14406646454 016062 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sheets_id-class.R
\name{sheets_id}
\alias{sheets_id}
\alias{as_sheets_id}
\title{\code{sheets_id} class}
\usage{
as_sheets_id(x, ...)
}
\arguments{
\item{x}{Something that contains a Google Sheet id: an id string, a
\code{\link[googledrive:drive_id]{drive_id}}, a URL, a one-row
\code{\link[googledrive:dribble]{dribble}}, or a \code{googlesheets4_spreadsheet}.}
\item{...}{Other arguments passed down to methods. (Not used.)}
}
\description{
\code{sheets_id} is an S3 class that marks a string as a Google Sheet's id, which
the Sheets API docs refer to as \code{spreadsheetId}.
Any object of class \code{sheets_id} also has the \code{\link[googledrive:drive_id]{drive_id}}
class, which is used by \link{googledrive} for the same purpose. This means you
can provide a \code{sheets_id} to \link{googledrive} functions, in order to do anything
with your Sheet that has nothing to do with it being a spreadsheet. Examples:
change the Sheet's name, parent folder, or permissions. Read more about using
\link{googlesheets4} and \link{googledrive} together in \code{vignette("drive-and-sheets")}.
Note that a \code{sheets_id} object is intended to hold \strong{just one} id, while the
parent class \code{drive_id} can be used for multiple ids.
\code{as_sheets_id()} is a generic function that converts various inputs into an
instance of \code{sheets_id}. See more below.
When you print a \code{sheets_id}, we attempt to reveal the Sheet's current
metadata, via \code{\link[=gs4_get]{gs4_get()}}. This can fail for a variety of reasons (e.g. if
you're offline), but the input \code{sheets_id} is always revealed and returned,
invisibly.
}
\section{\code{as_sheets_id()}}{
These inputs can be converted to a \code{sheets_id}:
\itemize{
\item Spreadsheet id, "a string containing letters, numbers, and some special
characters", typically 44 characters long, in our experience. Example:
\verb{1qpyC0XzvTcKT6EISywvqESX3A0MwQoFDE8p-Bll4hps}.
\item A URL, from which we can excavate a spreadsheet or file id. Example:
\code{"https://docs.google.com/spreadsheets/d/1BzfL0kZUz1TsI5zxJF1WNF01IxvC67FbOJUiiGMZ_mQ/edit#gid=1150108545"}.
\item A one-row \code{\link[googledrive:dribble]{dribble}}, a "Drive tibble" used by the
\link{googledrive} package. In general, a \code{dribble} can represent several
files, one row per file. Since googlesheets4 is not vectorized over
spreadsheets, we are only prepared to accept a one-row \code{dribble}.
\itemize{
\item \code{\link[googledrive:drive_get]{googledrive::drive_get("YOUR_SHEET_NAME")}}
is a great way to look up a Sheet via its name.
\item \code{\link[=gs4_find]{gs4_find("YOUR_SHEET_NAME")}} is another good way
to get your hands on a Sheet.
}
\item Spreadsheet meta data, as returned by, e.g., \code{\link[=gs4_get]{gs4_get()}}. Literally,
this is an object of class \code{googlesheets4_spreadsheet}.
}
}
\examples{
\dontshow{if (gs4_has_token()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
mini_gap_id <- gs4_example("mini-gap")
class(mini_gap_id)
mini_gap_id
as_sheets_id("abc")
\dontshow{\}) # examplesIf}
}
\seealso{
\link[googledrive:drive_id]{googledrive::as_id}
}
googlesheets4/man/sheet_write.Rd 0000644 0001762 0000144 00000010157 14406646454 016433 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sheet_write.R
\name{sheet_write}
\alias{sheet_write}
\alias{write_sheet}
\title{(Over)write new data into a Sheet}
\usage{
sheet_write(data, ss = NULL, sheet = NULL)
write_sheet(data, ss = NULL, sheet = NULL)
}
\arguments{
\item{data}{A data frame. If it has zero rows, we send one empty pseudo-row
of data, so that we can apply the usual table styling. This empty row goes
away (gets filled, actually) the first time you send more data with
\code{\link[=sheet_append]{sheet_append()}}.}
\item{ss}{Something that identifies a Google Sheet:
\itemize{
\item its file id as a string or \code{\link[googledrive:drive_id]{drive_id}}
\item a URL from which we can recover the id
\item a one-row \code{\link[googledrive:dribble]{dribble}}, which is how googledrive
represents Drive files
\item an instance of \code{googlesheets4_spreadsheet}, which is what \code{\link[=gs4_get]{gs4_get()}}
returns
}
Processed through \code{\link[=as_sheets_id]{as_sheets_id()}}.}
\item{sheet}{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.}
}
\value{
The input \code{ss}, as an instance of \code{\link{sheets_id}}
}
\description{
This is one of the main ways to write data with googlesheets4. This function
writes a data frame into a (work)sheet inside a (spread)Sheet. The target
sheet is styled as a table:
\itemize{
\item Special formatting is applied to the header row, which holds column
names.
\item The first row (header row) is frozen.
\item The sheet's dimensions are set to "shrink wrap" the \code{data}.
}
If no existing Sheet is specified via \code{ss}, this function delegates to
\code{\link[=gs4_create]{gs4_create()}} and the new Sheet's name is randomly generated. If that's
undesirable, call \code{\link[=gs4_create]{gs4_create()}} directly to get more control.
If no \code{sheet} is specified or if \code{sheet} doesn't identify an existing sheet,
a new sheet is added to receive the \code{data}. If \code{sheet} specifies an existing
sheet, it is effectively overwritten! All pre-existing values, formats, and
dimensions are cleared and the targeted sheet gets new values and dimensions
from \code{data}.
This function goes by two names, because we want it to make sense in two
contexts:
\itemize{
\item \code{write_sheet()} evokes other table-writing functions, like
\code{readr::write_csv()}. The \code{sheet} here technically refers to an individual
(work)sheet (but also sort of refers to the associated Google
(spread)Sheet).
\item \code{sheet_write()} is the right name according to the naming convention used
throughout the googlesheets4 package.
}
\code{write_sheet()} and \code{sheet_write()} are equivalent and you can use either one.
}
\examples{
\dontshow{if (gs4_has_token()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
df <- data.frame(
x = 1:3,
y = letters[1:3]
)
# specify only a data frame, get a new Sheet, with a random name
ss <- write_sheet(df)
read_sheet(ss)
# clean up
googledrive::drive_trash(ss)
# create a Sheet with some initial, placeholder data
ss <- gs4_create(
"sheet-write-demo",
sheets = list(alpha = data.frame(x = 1), omega = data.frame(x = 1))
)
# write df into its own, new sheet
sheet_write(df, ss = ss)
# write mtcars into the sheet named "omega"
sheet_write(mtcars, ss = ss, sheet = "omega")
# get an overview of the sheets
sheet_properties(ss)
# view your magnificent creation in the browser
gs4_browse(ss)
# clean up
gs4_find("sheet-write-demo") \%>\%
googledrive::drive_trash()
\dontshow{\}) # examplesIf}
}
\seealso{
Other write functions:
\code{\link{gs4_create}()},
\code{\link{gs4_formula}()},
\code{\link{range_delete}()},
\code{\link{range_flood}()},
\code{\link{range_write}()},
\code{\link{sheet_append}()}
Other worksheet functions:
\code{\link{sheet_add}()},
\code{\link{sheet_append}()},
\code{\link{sheet_copy}()},
\code{\link{sheet_delete}()},
\code{\link{sheet_properties}()},
\code{\link{sheet_relocate}()},
\code{\link{sheet_rename}()},
\code{\link{sheet_resize}()}
}
\concept{worksheet functions}
\concept{write functions}
googlesheets4/man/googlesheets4-configuration.Rd 0000644 0001762 0000144 00000005225 14275601106 021517 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/googlesheets4-package.R, R/utils-ui.R
\name{googlesheets4-configuration}
\alias{googlesheets4-configuration}
\alias{local_gs4_quiet}
\alias{with_gs4_quiet}
\title{googlesheets4 configuration}
\usage{
local_gs4_quiet(env = parent.frame())
with_gs4_quiet(code)
}
\arguments{
\item{env}{The environment to use for scoping}
\item{code}{Code to execute quietly}
}
\description{
Some aspects of googlesheets4 behaviour can be controlled via an option.
}
\section{Messages}{
The \code{googlesheets4_quiet} option can be used to suppress messages from
googlesheets4. By default, googlesheets4 always messages, i.e. it is \emph{not}
quiet.
Set \code{googlesheets4_quiet} to \code{TRUE} to suppress messages, by one of these
means, in order of decreasing scope:
\itemize{
\item Put \code{options(googlesheets4_quiet = TRUE)} in a start-up file, such as
\code{.Rprofile}, or in your R script
\item Use \code{local_gs4_quiet()} to silence googlesheets4 in a specific scope
\item Use \code{with_gs4_quiet()} to run a small bit of code silently
}
\code{local_gs4_quiet()} and \code{with_gs4_quiet()} follow the conventions of the
the withr package (\url{https://withr.r-lib.org}).
}
\section{Auth}{
Read about googlesheets4's main auth function, \code{\link[=gs4_auth]{gs4_auth()}}. It is powered
by the gargle package, which consults several options:
\itemize{
\item Default Google user or, more precisely, \code{email}: see
\code{\link[gargle:gargle_options]{gargle::gargle_oauth_email()}}
\item Whether or where to cache OAuth tokens: see
\code{\link[gargle:gargle_options]{gargle::gargle_oauth_cache()}}
\item Whether to prefer "out-of-band" auth: see
\code{\link[gargle:gargle_options]{gargle::gargle_oob_default()}}
\item Application Default Credentials: see \code{\link[gargle:credentials_app_default]{gargle::credentials_app_default()}}
}
}
\examples{
\dontshow{if (gs4_has_token()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
# message: "Creating new Sheet ..."
(ss <- gs4_create("gs4-quiet-demo", sheets = "alpha"))
# message: "Editing ..., Writing ..."
range_write(ss, data = data.frame(x = 1, y = "a"))
# suppress messages for a small amount of code
with_gs4_quiet(
ss \%>\% sheet_append(data.frame(x = 2, y = "b"))
)
# message: "Writing ..., Appending ..."
ss \%>\% sheet_append(data.frame(x = 3, y = "c"))
# suppress messages until end of current scope
local_gs4_quiet()
ss \%>\% sheet_append(data.frame(x = 4, y = "d"))
# see that all the data was, in fact, written
read_sheet(ss)
# clean up
gs4_find("gs4-quiet-demo") \%>\%
googledrive::drive_trash()
\dontshow{\}) # examplesIf}
}
googlesheets4/man/gs4_create.Rd 0000644 0001762 0000144 00000004213 14275601106 016112 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/gs4_create.R
\name{gs4_create}
\alias{gs4_create}
\title{Create a new Sheet}
\usage{
gs4_create(name = gs4_random(), ..., sheets = NULL)
}
\arguments{
\item{name}{The name of the new spreadsheet.}
\item{...}{Optional spreadsheet properties that can be set through this API
endpoint, such as locale and time zone.}
\item{sheets}{Optional input for initializing (work)sheets. If unspecified,
the Sheets API automatically creates an empty "Sheet1". You can provide a
vector of sheet names, a data frame, or a (possibly named) list of data
frames. See the examples.}
}
\value{
The input \code{ss}, as an instance of \code{\link{sheets_id}}
}
\description{
Creates an entirely new (spread)Sheet (or, in Excel-speak, workbook).
Optionally, you can also provide names and/or data for the initial set of
(work)sheets. Any initial data provided via \code{sheets} is styled as a table,
as described in \code{\link[=sheet_write]{sheet_write()}}.
}
\examples{
\dontshow{if (gs4_has_token()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
gs4_create("gs4-create-demo-1")
gs4_create("gs4-create-demo-2", locale = "en_CA")
gs4_create(
"gs4-create-demo-3",
locale = "fr_FR",
timeZone = "Europe/Paris"
)
gs4_create(
"gs4-create-demo-4",
sheets = c("alpha", "beta")
)
my_data <- data.frame(x = 1)
gs4_create(
"gs4-create-demo-5",
sheets = my_data
)
gs4_create(
"gs4-create-demo-6",
sheets = list(chickwts = head(chickwts), mtcars = head(mtcars))
)
# Clean up
gs4_find("gs4-create-demo") \%>\%
googledrive::drive_trash()
\dontshow{\}) # examplesIf}
}
\seealso{
Wraps the \code{spreadsheets.create} endpoint:
\itemize{
\item \url{https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/create}
}
There is an article on writing Sheets:
\itemize{
\item \url{https://googlesheets4.tidyverse.org/articles/articles/write-sheets.html}
}
Other write functions:
\code{\link{gs4_formula}()},
\code{\link{range_delete}()},
\code{\link{range_flood}()},
\code{\link{range_write}()},
\code{\link{sheet_append}()},
\code{\link{sheet_write}()}
}
\concept{write functions}
googlesheets4/man/gs4_random.Rd 0000644 0001762 0000144 00000000676 14074074641 016145 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/gs4_create.R
\name{gs4_random}
\alias{gs4_random}
\title{Generate a random Sheet name}
\usage{
gs4_random(n = 1)
}
\arguments{
\item{n}{Number of names to generate.}
}
\value{
A character vector.
}
\description{
Generates a random name, suitable for a newly created Sheet, using
\code{\link[ids:adjective_animal]{ids::adjective_animal()}}.
}
\examples{
gs4_random()
}
googlesheets4/man/gs4_scopes.Rd 0000644 0001762 0000144 00000003315 14440453710 016145 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/gs4_auth.R
\name{gs4_scopes}
\alias{gs4_scopes}
\title{Produce scopes specific to the Sheets API}
\usage{
gs4_scopes(scopes = NULL)
}
\arguments{
\item{scopes}{One or more API scopes. Each scope can be specified in full or,
for Sheets API-specific scopes, in an abbreviated form that is recognized by
\code{\link[=gs4_scopes]{gs4_scopes()}}:
\itemize{
\item "spreadsheets" = "https://www.googleapis.com/auth/spreadsheets"
(the default)
\item "spreadsheets.readonly" =
"https://www.googleapis.com/auth/spreadsheets.readonly"
\item "drive" = "https://www.googleapis.com/auth/drive"
\item "drive.readonly" = "https://www.googleapis.com/auth/drive.readonly"
\item "drive.file" = "https://www.googleapis.com/auth/drive.file"
}
See
\url{https://developers.google.com/identity/protocols/oauth2/scopes#sheets} for
details on the permissions for each scope.}
}
\value{
A character vector of scopes.
}
\description{
When called with no arguments, \code{gs4_scopes()} returns a named character
vector of scopes associated with the Sheets API. If \code{gs4_scopes(scopes =)} is
given, an abbreviated entry such as \code{"sheets.readonly"} is expanded to a full
scope (\code{"https://www.googleapis.com/auth/sheets.readonly"} in this case).
Unrecognized scopes are passed through unchanged.
}
\examples{
gs4_scopes("spreadsheets")
gs4_scopes("spreadsheets.readonly")
gs4_scopes("drive")
gs4_scopes()
}
\seealso{
\url{https://developers.google.com/identity/protocols/oauth2/scopes#sheets} for
details on the permissions for each scope.
Other auth functions:
\code{\link{gs4_auth_configure}()},
\code{\link{gs4_auth}()},
\code{\link{gs4_deauth}()}
}
\concept{auth functions}
googlesheets4/man/gs4_examples.Rd 0000644 0001762 0000144 00000002304 14406646454 016477 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/gs4_example.R
\name{gs4_examples}
\alias{gs4_examples}
\alias{gs4_example}
\title{Example Sheets}
\usage{
gs4_examples(matches)
gs4_example(matches)
}
\arguments{
\item{matches}{A regular expression that matches the name of the desired
example Sheet(s). \code{matches} is optional for the plural \code{gs4_examples()}
and, if provided, it can match multiple Sheets. The singular
\code{gs4_example()} requires \code{matches} and it must match exactly one Sheet.}
}
\value{
\itemize{
\item \code{gs4_example()}: a \link{sheets_id}
\item \code{gs4_examples()}: a named vector of all built-in examples, with class
\code{\link[googledrive:drive_id]{drive_id}}
}
}
\description{
googlesheets4 makes a variety of world-readable example Sheets available for
use in documentation and reprexes. These functions help you access the
example Sheets. See \code{vignette("example-sheets", package = "googlesheets4")}
for more.
}
\examples{
\dontshow{if (gs4_has_token()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
gs4_examples()
gs4_examples("gap")
gs4_example("gapminder")
gs4_example("deaths")
\dontshow{\}) # examplesIf}
}
googlesheets4/man/figures/ 0000755 0001762 0000144 00000000000 14407102342 015242 5 ustar ligges users googlesheets4/man/figures/lifecycle-defunct.svg 0000644 0001762 0000144 00000002424 14407076245 021366 0 ustar ligges users
googlesheets4/man/figures/lifecycle-maturing.svg 0000644 0001762 0000144 00000002430 14407076245 021561 0 ustar ligges users
googlesheets4/man/figures/logo.png 0000644 0001762 0000144 00000116031 14407102342 016712 0 ustar ligges users PNG
IHDR ޫh gAMA a cHRM z&