使用R下载Excel文件

我试图从哥伦比亚的中央银行网站下载一个Excel文件,但似乎通常的download.file函数无法完成这项工作。

例如,我正试图在此页面下载第一个文件“Serie historica”: http : //www.banrep.gov.co/es/indice-tasa-cambio-real

该文件的链接如下,我用在download.filefunctionhttp://obieebr.banrep.gov.co/analytics/saw.dll?Download&Format=excel2007&Extension=.xls&BypassCache=true&path=%2Fshared%2FSeries% 20Estad%C3%adsticas_T%2F1。%20Indice%20de%20Tasa%20de%20Cambio%20Real%2F1.1%20Serie%20historica_IQY&SyncOperation = 1&NQUser =&检察署= NQPassword检察署

我使用的命令是:download.file(filepath,destfile,quiet = FALSE,mode =“wb”)

任何帮助是极大的赞赏!

我希望这个例子会引导你

 library(readxl) library(httr) url1<-'https://evs.nci.nih.gov/ftp1/CDISC/SDTM/SDTM%20Terminology.xls' GET(url1, write_disk(tf <- tempfile(fileext = ".xls"))) df <- read_excel(tf, 2L) str(df) 

如果你可以下载文件,你可以阅读如下

 library(readxl) datos <- read_xlsx("C:/Users/USER/Downloads/1.1. Serie historica_IQY.xlsx", skip = 8, n_max = 369) 
Interesting Posts