
The read_sheet() will read in the data for you. R will attempt to authenticate your Google account through the Tidyverse API: The data set will be named forestArea.įirst, you’ll need to authenticate with your Google account if you’re using the read_sheet() function to access a Google Sheet. The data contain a list of the 15 most forested countries, with forest area measured in millions of hectares. The package can be installed from CRAN: install.packages("googlesheets4")Īnd attached with the library() function: library(googlesheets4)įor this example, I’ll import that data located in this Google Sheet. The “4” is designated because it uses the fourth version of the Google Sheets API. The googlesheets4 package is a re-release of the googlesheets package developed by Jenny Bryan with R Studio.

This post describes the googlesheets4 package, an R interface to the Google Sheets that is a part of the tidyverse. If you perform your forest data analysis in R, getting data imported and in the format you want is often half the battle. Excel still dominates the spreadsheet universe, especially within established organizations.

Using Google Sheets to store data has several advantages:

(It had been a while since I imported data from a database.) I recently researched the most up-to-date ways to import data from an Access database into R. You might be using fewer Excel spreadsheets and. If you’re like me, more of the data you use on a daily basis are stored in Google Sheets.
