0

I have a secure Url which provides data in Excel format. How do I read it in R studio?

Please mention the necessary package and functions. I have tried read.xls(), read_xlsx, read.URL and some more. Nothing seems to work.

d.b
  • 32,245
  • 6
  • 36
  • 77
Samprita
  • 21
  • 1
  • 3
  • https://stackoverflow.com/a/41368947/10447055 does this help you? – Gainz Mar 12 '20 at 15:16
  • Does this answer your question? [Read Excel file from a URL using the readxl package](https://stackoverflow.com/questions/41368628/read-excel-file-from-a-url-using-the-readxl-package) – Gainz Mar 12 '20 at 15:31

3 Answers3

1

You can do it in two steps. First, you'll need to download it with something like download.file, then read it with readxl::read_excel

download.file("https://file-examples.com/wp-content/uploads/2017/02/file_example_XLS_10.xls", destfile = "/tmp/file.xls")
readxl::read_excel("/tmp/file.xls")
csgroen
  • 2,511
  • 11
  • 28
  • Tried this. It does not work. Any other way? It throws this https://www.screencast.com/t/vjaCRwNmi7 – Samprita Mar 12 '20 at 15:40
  • @Samprita it appears your error is indicating you have specified a file extension xlsx instead of xls. This may be the issue. Alternatively, your firewall may block the connection which is an issue with this type of question. – M_Merciless May 20 '21 at 13:42
  • You can try saving to another location, preferably in your home directory where you certainly will have read/write permissions – csgroen May 21 '21 at 08:42
-1
library(readxl)
library(httr)

url<-'https://......xls'
GET(url, write_disk(TF <- tempfile(fileext = ".xls")))
read_excel(TF)
Peyman Mohamadpour
  • 17,954
  • 24
  • 89
  • 100
-2

Have you tried importing it as a .csv dataset into RStudio? Might be worth a try!:)