[R] Download and Import xls files in R

Gabor Grothendieck ggrothendieck at gmail.com
Sat Mar 7 12:33:45 CET 2009


Try this:

> library(gdata)
> ciao<-read.xls(pattern = "TOTALE", "http://www.giustizia.it/statistiche/statistiche_dap/det/seriestoriche/corsi_proff.xls")
Downloading...
trying URL 'http://www.giustizia.it/statistiche/statistiche_dap/det/seriestoriche/corsi_proff.xls'
Content type 'application/vnd.ms-excel' length 33280 bytes (32 Kb)
opened URL
downloaded 32 Kb

Done.
Converting xls file to csv file... Done.
Searching for lines containing pattern  TOTALE ... Done.
Reading csv file... Done.
> head(ciao)
           X X.1 UOMINI DONNE TOTALE  X.2 UOMINI.1 DONNE.1 TOTALE.1 UOMINI.2
1  I sem. 91 185     nd    nd 1,926    nd       nd      nd       nd       nd
2 II sem. 91 275     nd    nd 2,470   89        nd      nd       nd       nd
3   I sem.92 230 3,265   432  3,697  133    1,524     200    1,724      543
4  II sem.92 205 2,581   417  2,998   83      864     115      979      413
5   I sem.93 241 3,165   439  3,604  105    1,171     222    1,393      661
6  II sem.93 256 2,844   395  3,239   94      986     102    1,088      516
  DONNE.2 TOTALE.2
1      nd      nd
2      nd      nd
3     88     631
4     66     479
5     91     752
6     79     595
>


On Fri, Mar 6, 2009 at 10:04 PM, Francesco Petrarca
<francesco.petrarca09 at gmail.com> wrote:
> Dear List,
>
> I am trying to solve a problem: I have approximately 100 Excel
> spreadsheets each with approximately 4 sheet each that I would like to
> download and import in R for analysis.
>
> Unfortunately i realized (i also sent an email to the author or
> xlsReadWrite() ) that the read.xls() doesn't allow to import the file in
> R from internet.
> Here it is the the code:
>
>  ciao<-read.xls("http://www.giustizia.it/statistiche/statistiche_dap/det/seriestoriche/corsi_proff.xls")
>
> This doesn't work..
>
> How would you solve the problem in an automated way? I would not like to
> manually download each one, open it with excel and saving in in csv?
>
> Thanks,
>
> Francesco
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>




More information about the R-help mailing list