googlesheets is a really useful package developed by Jennifer Bryan, enabling users to connect to and work with google sheets through R. That’s pretty useful when you want to collaborate with others on the same document, among other things!

To get started:

# Install Google Sheets library
devtools::install_github("jennybc/googlesheets")

# Attach it to the session
library(googlesheets)

# Authorize user
gs_auth(new_user = TRUE) ## To authorize your google account for use by googlesheets

# List google sheets in your drive
gs_ls()

# Read in spread-sheet using shareable link (from File -> Share)
bt = gs_url("https://your/sheet's/shareable/link")
bt

# Open spread sheet in browser
# gs_browse(bt) ## Opens sheet in browse

# Read in sheet of your interest
sh = gs_read(bt, ws = 2) # choosing sheet 2

# Convert to dataframe if you want/need
df = as.data.frame(sh)
str(df)
df

# And we're done!! Onwards to using this :) 

Github repo for package: https://github.com/jennybc/googlesheets

Slides: Slides for an rOpenSci Community Call in March 2016