googlesheets4 will, by default, help you interact with Sheets as an authenticated Google user. The package facilitates this process upon first need.
If you don’t need to access private Sheets, use
gs4_deauth() to indicate there is no need for a token. This puts googlesheets4 into a de-authorized mode.
Here’s how an R script might look if all you plan to do is read Sheets that are world-readable or readable by “anyone with a link”:
As soon as googlesheets4 needs a token, it tries to discover one. If it fails, it engages with you interactively to help you get a token. Once successful, that token is remembered for subsequent use in that R session.
Users can take control of auth proactively via the
gs4_auth*() family of functions. Examples of what you can control or provide:
Auth is actually handled by the gargle package (gargle.r-lib.org), similar to googledrive, bigrquery, and gmailr, and gargle’s documentation and articles are the definitive guide to more advanced topics.