How to read Google Sheets data into R

Manpreet Singh
3 min readApr 20, 2021

Welcome back! Yesterday we talked about the powerful GoogleSheets4 package within R, this allows you to communicate with Google Sheets from your R environment. In this tutorial i’ll break down exactly how to read data from your Google Sheets account into your R environment, let’s get started!


First off, we want to install the Google Sheets 4 package, to do this, use the following installation line inside of your R console:


Developing The Code

Awesome, next up we want to import that library into our environment, to do so, use the following line:


Next up we want to essentially read the Google Sheet into our enviornment, we have a couple of ways to read it in, we can use the URL of the Google Sheet just like below:


You will essentially get a little prompt in our R console which allows you to give access from your Google Account to the API:

A little hard to read, but just follow the prompts and you’ll be good to go. Next up, you want to make your way over to your R console and watch some magic happen, you will eventually see this output in your R console, this will essentially download the data from Google Sheets:

From there, you can store that data within a variable as well:

Awesome! You can also use the Sheet ID from Google Sheets as well:


This is the output: