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?
Asked
Active
Viewed 1,661 times
1
-
possible duplicate of [read.csv fails to read a CSV file from google docs](http://stackoverflow.com/questions/5834821/read-csv-fails-to-read-a-csv-file-from-google-docs) – r.bot Apr 04 '15 at 19:39
-
http://cran.r-project.org/web/packages/gsheet/gsheet.pdf might be helpful – Tyler Rinker Apr 04 '15 at 19:44
2 Answers
6
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
:

jennybryan
- 2,606
- 2
- 18
- 33
0
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.

Konrad
- 17,740
- 16
- 106
- 167