Export data from Google Sheets to R

Asked

Viewed 204 times

7

Hey, guys, what’s up? I’m a beginner in R and I have a question: It is possible, and if possible, which is the way to export data from a table of google Sheets (or Drive) to R. There is some library for this?

  • 3

    You can try using the package googlesheets. Here the manual and here an example.

  • It helped a lot! I managed to do the export! Thank you very much!

  • @Willianvieira, how about posting as an answer to help those looking for this question in the future?

1 answer

6


You can use the package googlesheets, here will a link demonstrating an example of using this package.

To find other packages with keywords that we don’t know yet, besides searching on google, there are some options direct the environment R:

function findFn() package sos:

sos::findFn('google')
sos::findFm('sheets')

This function returns a web page with a table of possible functions and their respective packages.

function search.cran() package NCmisc:

NCmisc::search.cran('google')
# $google
#  [1] "googleAnalyticsR"        "googleAuthR"
#  [3] "googleCloudStorageR"     "googleComputeEngineR"
#  [5] "googledrive"             "googleformr"
#  [7] "GoogleKnowledgeGraphR"   "googleLanguageR"
#  [9] "googlenlp"               "googlePolylines"
# [11] "googlePrintr"            "googlePublicData"
# [13] "googlesheets"            "googleVis"
# [15] "googleway"               "plotGoogleMaps"
# [17] "RGoogleAnalyticsPremium" "RGoogleFit"
# [19] "RgoogleMaps"             "rgoogleslides"


NCmisc::search.cran('sheets')
# $sheets
# [1] "googlesheets"

If the keyword is common, we can use the function grep() to find a second keyword in the list:

google <- NCmisc::search.cran('google')[[1]]

google[grep('sheet', google)]
# [1] "googlesheets"

Or simply use more than one keyword in the function search.cran():

NCmisc::search.cran(c('google','sheet'))
# [1] "episheet" "googlesheets" "gsheet"

More options for searching packages are available here.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.