-1

I have a link to the Google sheets:

https://docs.google.com/spreadsheets/d/1M_S3iR5u7Ef5teNXWXVWH-EuokFNQ3Kd5dGt_T0YeH8/pubhtml

I want to link this data directly with R and store it in a data frame .

Tried many things shared on the internet but nothing worked at all .

In fact here is the link to the stackoverflow question, it is quite long and confusing and doesn't work in this case .

Any ideas ?

Community
  • 1
  • 1
Pankaj Kaundal
  • 1,012
  • 3
  • 13
  • 25
  • 1
    use this package? https://github.com/jennybc/googlesheets – chinsoon12 Apr 20 '16 at 08:05
  • "Tried many things" - please provide your attempts, so we don't have to repeat what you have already tried. – zx8754 Apr 20 '16 at 08:05
  • 1
    Agree with chinsoon12. googlesheets is available off CRAN repository. The basic usage are well-detailed at http://htmlpreview.github.io/?https://raw.githubusercontent.com/jennybc/googlesheets/master/vignettes/basic-usage.html – Adam Quek Apr 20 '16 at 08:07

1 Answers1

1

To import the googlesheet as a data.frame in R:

# install.packages("googlesheets")
library("googlesheets")

GAP<-gs_url("https://docs.google.com/spreadsheets/d/1M_S3iR5u7Ef5teNXWXVWH-EuokFNQ3Kd5dGt_T0YeH8/pubhtml")

gs_browse(GAP)

dat2<-gs_read(dat,ws = 1, range="A1:C6")

The data frame is return as:

> dat2
Source: local data frame [5 x 3]

      A     B     V
  (int) (int) (int)
1     1     5     0
2     2     4     9
3     3     3     8
4     4     2     7
5     5     1     6
Adam Quek
  • 6,973
  • 1
  • 17
  • 23