Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/maxconway/gsheet
Download Google Sheets to R
https://github.com/maxconway/gsheet
Last synced: 3 days ago
JSON representation
Download Google Sheets to R
- Host: GitHub
- URL: https://github.com/maxconway/gsheet
- Owner: maxconway
- Created: 2015-03-05T13:58:14.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2020-04-07T14:34:45.000Z (over 4 years ago)
- Last Synced: 2024-08-02T06:03:48.065Z (3 months ago)
- Language: R
- Homepage:
- Size: 52.7 KB
- Stars: 55
- Watchers: 2
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.Rmd
Awesome Lists containing this project
- jimsghstars - maxconway/gsheet - Download Google Sheets to R (R)
README
---
output: github_document
---```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
```# gsheet
[![Travis-CI Build Status](https://travis-ci.org/maxconway/gsheet.png?branch=master)](https://travis-ci.org/maxconway/gsheet)
[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/gsheet)](https://cran.r-project.org/package=gsheet)gsheet is a simple package to download [Google Sheets](https://www.google.com/sheets/about/ (aka Google Docs Spreadsheets) using just the sharing link. Sheets can be downloaded as a data frame, or as plain text to parse manually.
## Installation
Install from CRAN with:
```{r, eval=FALSE}
install.packages('gsheet')
```Or install the latest development version from github with:
```{r, eval=FALSE}
devtools::install_github("maxconway/gsheet")
```## Getting started
Download a google sheet as a table with:
```{r, eval=FALSE}
library(gsheet)
gsheet2tbl('docs.google.com/spreadsheets/d/1I9mJsS5QnXF2TNNntTy-HrcdHmIF9wJ8ONYvEJTXSNo')
```## Advanced
### More control
If you want more control, you might want to use something like:
```{r, eval=FALSE}
url <- 'docs.google.com/spreadsheets/d/1I9mJsS5QnXF2TNNntTy-HrcdHmIF9wJ8ONYvEJTXSNo'
a <- gsheet2text(url, format='csv')
b <- read.csv(a, stringsAsFactors=FALSE)
```
This way the table can be cleaned before parsing, and different options can be used in parsing.### Downloading other sheets
If you want to download a sheet other than the first, you have to use the direct url, copied from the address bar, like so:
```{r, eval=FALSE}
url <- 'docs.google.com/spreadsheets/1I9mJsS5QnXF2TNNntTy-HrcdHmIF9wJ8ONYvEJTXSNo#gid=850032961'
b <- gsheet2tbl(url)
```
This works because this makes the `gid`, which is the sheet identifier, available.
If you have problems downloading the first sheet, this can also help too.