I am trying to download an Excel file from Central bank of Colombia website, but it seems that the usual download.file function couldn't do the job.
For example, I am trying to download the first file "Serie historica" on this page: http://www.banrep.gov.co/es/indice-tasa-cambio-real
The link to the file is as follows, which I used in the download.file function http://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=publico&NQPassword=publico
The command I used is:
download.file(filepath, destfile, quiet=FALSE, mode="wb")
I hope this example will guide you
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)
If you can download the file you could read it as follows
library(readxl)
datos <- read_xlsx("C:/Users/USER/Downloads/1.1. Serie historica_IQY.xlsx", skip = 8, n_max = 369)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With