Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

gs_download

Download a spreadsheet


Description

Export a Google Sheet as a .csv, .pdf, or .xlsx file. You can download a sheet that you own or a sheet owned by a third party that has been made accessible via the sharing dialog options. You can download the entire spreadsheet (.pdf and .xlsx formats only) or a single worksheet (all formats). This function calls the Google Drive API.

Usage

gs_download(from, ws = NULL, to = NULL, overwrite = FALSE,
  verbose = TRUE)

Arguments

from

a registered Google spreadsheet, i.e. a googlesheet object

ws

positive integer or character string specifying index or title, respectively, of the worksheet

to

path to write file; file extension must be one of .csv, .pdf, or .xlsx, which dictates the export format; defaults to foo.xlsx where foo is a safe filename constructed from the title of the Sheet being downloaded

overwrite

logical, indicating whether to overwrite an existing local file

verbose

logical; do you want informative messages?

Details

If the worksheet is unspecified, i.e. if ws = NULL, then the entire spreadsheet will be exported (.pdf and xlsx formats) or the first worksheet will be exported (.csv format)

Value

The normalized path of the downloaded file, after confirmed success, or NULL, otherwise, invisibly.

Examples

## Not run: 
gs_download(gs_gap(), to = "gapminder.xlsx")
file.remove("gapminder.xlsx")

## End(Not run)

googlesheets

Manage Google Spreadsheets from R

v0.3.0
MIT + file LICENSE
Authors
Jennifer Bryan [aut, cre], Joanna Zhao [aut]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.