TMOTTM
TMOTTM

Reputation: 3381

How to download google docs spreadsheet through R

I would like to download a google docs spreadsheet using R and then import the spreadsheet as a csv file in a small shiny server app. How could I do that?

Upvotes: 1

Views: 1705

Answers (2)

jennybryan
jennybryan

Reputation: 2601

Try the new googlesheets package, which is an R API for Google Sheets:

https://github.com/jennybc/googlesheets

This snippet will install the package, copy a Sheet to your Google Drive, register it for access, and import data from one tab or worksheet into a local data.frame:

devtools::install_github("jennybc/googlesheets")
gap_key <- "1HT5B8SgkKqHdqHJmn5xiuaC04Ngb7dG9Tv94004vezA"
copy_ss(key = gap_key, to = "Gapminder")
gap <- register_ss("Gapminder")
oceania_csv <- get_via_csv(gap, ws = "Oceania")

As for integration with Shiny, see the shinyga package which recently incorporated support for googlesheets:

https://github.com/MarkEdmondson1234/shinyga

Upvotes: 6

Konrad
Konrad

Reputation: 18585

You can use RGoogle Docs package to access the Google Docs content. Other option worth consider is the RGoogle Data package that provides access to Google services.

Upvotes: 0

Related Questions