[R] Download xls file from internet

Eik Vettorazzi E.Vettorazzi at uke.uni-hamburg.de
Thu Aug 5 23:35:01 CEST 2010


hi pete,
try
download.file("http://ir.eia.gov/wpsr/psw09.xls","C:\\Temp\\psw09.xls",mode="wb")
since xls are binary files.

cheers

Am 05.08.2010 23:25, schrieb Pete B:
> 
> I am trying to download an Excel file from the the internet with the
> following R command
> 
> download.file("http://ir.eia.gov/wpsr/psw09.xls","C:\\Temp\\psw09.xls")
> 
> The file is downloaded but when I try and open it I get a message from Excel
> telling me that the file is corrupt and it cannot be opened.
> 
> If I manually download the file it opens without problems.
> 
> Any insights would be gratefully received.
> 
> Kind regards
> 
> Pete
> 
> 
> 
> 


-- 
Eik Vettorazzi
Institut für Medizinische Biometrie und Epidemiologie
Universitätsklinikum Hamburg-Eppendorf

Martinistr. 52
20246 Hamburg

T ++49/40/7410-58243
F ++49/40/7410-57790



More information about the R-help mailing list