construct_download_url: Construct a google sheet download url from the sheet's...

Description Usage Arguments Examples

View source: R/construct_download_url.R

Description

Converts the viewing url for a google sheet to a download url.

Usage

1
construct_download_url(url, format = "csv", sheetid = NULL)

Arguments

url

the google sheet url

format

controls the column separator used. csv or tsv

sheetid

the id of the sheet to download from. (Default NULL, downloads the first sheet)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
# Download a sheet manually using readr
url <- 'docs.google.com/spreadsheets/d/1I9mJsS5QnXF2TNNntTy-HrcdHmIF9wJ8ONYvEJTXSNo'

if(requireNamespace('readr', quietly=TRUE)){
  library(readr)
  read_csv(construct_download_url(url), col_types = cols(
    mpg = col_double(),
    cyl = col_integer(),
    disp = col_double(),
    hp = col_integer(),
    drat = col_double(),
    wt = col_double(),
    qsec = col_double(),
    vs = col_integer(),
    am = col_integer(),
    gear = col_integer(),
    carb = col_integer()
  ))
}

maxconway/gsheet documentation built on April 20, 2020, 7:33 p.m.