Open Despertaferro opened 1 year ago
If it is useful to answer my question, I can see the following:
file.exists(paste([mywd],, myasset, ".xls", sep="")) [1] TRUE format_from_ext(paste([mywd], myasset, ".xls", sep="")) [1] "xls" format_from_signature(paste([mywd],, myasset, ".xls", sep="")) [1] NA
I download the file:
https://www.blackrock.com/lu/intermediaries/products/253743/ishares-sp-500-b-ucits-etf-acc-fund/1538022822830.ajax?fileType=xls&fileName=iShares-Core-SP-500-UCITS-ETF-USD-Acc_fund&dataType=fund
using httr's GET.
But when I try to read this file, using:
myasset <- "iShares-Core-SP-500-UCITS-ETF-USD-Acc_fund" read_excel(paste(my_wd, myasset, ".xls", sep=""), sheet = "Holdings")
I get the error message:
Error: filepath: [mywd]\iShares-Core-SP-500-UCITS-ETF-USD-Acc_fund.xls libxls error: Unable to open file
When I manually open the file, and I go to "Save as", I see that even though the file is saved as "*.xls", the extension is ".xml". I have checked with Blackrock, the provider, and also they see ".xml".
Instead, if I manually save the file as "*.xls", then I can open the file with read_excel.
Since I have many of these files, it is cumbersome to open the files manually, and to save them as ".xls" instead of the original ".xml".
Is there an R way to do that automatically?