[R] Problem in reading Excel spreadsheets

Ivan Calandra ivan.calandra at uni-hamburg.de
Wed Dec 1 10:05:40 CET 2010


Hi,

I don't know much about RODBC, but the package xlsReadWrite works pretty 
well for me for reading and writing xls files (and it doesn't need Perl 
or anything else to run).

Ivan

Le 12/1/2010 08:56, Stephen Liu a écrit :
> Hi folks,
>
> Win 7 64bit
> R 2.12.0 32bit
>
> Problem in reading Excel spreadsheets
>
> (the text file, research_databaseI.xls, was download on Internet)
>
>
>> data=odbcConnectExcel(file.choose())
>> sqlTables(data)
>                                                   TABLE_CAT TABLE_SCHEM
> 1  C:\\Users\\satimiswin764\\Documents\\research_databaseI<NA>
> 2  C:\\Users\\satimiswin764\\Documents\\research_databaseI<NA>
> 3  C:\\Users\\satimiswin764\\Documents\\research_databaseI<NA>
> 4  C:\\Users\\satimiswin764\\Documents\\research_databaseI<NA>
> 5  C:\\Users\\satimiswin764\\Documents\\research_databaseI<NA>
> 6  C:\\Users\\satimiswin764\\Documents\\research_databaseI<NA>
> 7  C:\\Users\\satimiswin764\\Documents\\research_databaseI<NA>
> 8  C:\\Users\\satimiswin764\\Documents\\research_databaseI<NA>
> 9  C:\\Users\\satimiswin764\\Documents\\research_databaseI<NA>
> 10 C:\\Users\\satimiswin764\\Documents\\research_databaseI<NA>
> 11 C:\\Users\\satimiswin764\\Documents\\research_databaseI<NA>
> 12 C:\\Users\\satimiswin764\\Documents\\research_databaseI<NA>
> 13 C:\\Users\\satimiswin764\\Documents\\research_databaseI<NA>
> 14 C:\\Users\\satimiswin764\\Documents\\research_databaseI<NA>
> 15 C:\\Users\\satimiswin764\\Documents\\research_databaseI<NA>
> 16 C:\\Users\\satimiswin764\\Documents\\research_databaseI<NA>
> 17 C:\\Users\\satimiswin764\\Documents\\research_databaseI<NA>
> 18 C:\\Users\\satimiswin764\\Documents\\research_databaseI<NA>
> 19 C:\\Users\\satimiswin764\\Documents\\research_databaseI<NA>
> 20 C:\\Users\\satimiswin764\\Documents\\research_databaseI<NA>
> 21 C:\\Users\\satimiswin764\\Documents\\research_databaseI<NA>
> 22 C:\\Users\\satimiswin764\\Documents\\research_databaseI<NA>
> 23 C:\\Users\\satimiswin764\\Documents\\research_databaseI<NA>
>                        TABLE_NAME   TABLE_TYPE REMARKS
> 1                           AGR$ SYSTEM TABLE<NA>
> 2                           BMC$ SYSTEM TABLE<NA>
> 3                         Dairy$ SYSTEM TABLE<NA>
> 4                           GDP$ SYSTEM TABLE<NA>
> 5                          HIES$ SYSTEM TABLE<NA>
> 6                         Manuf$ SYSTEM TABLE<NA>
> 7                        Prices$ SYSTEM TABLE<NA>
> 8                        Sheet1$ SYSTEM TABLE<NA>
> 9                           WPI$ SYSTEM TABLE<NA>
> 10             'Approved plans$'        TABLE<NA>
> 11                  'Emp stats$'        TABLE<NA>
> 12                   'Ex rates$'        TABLE<NA>
> 13            'hotel occ rates$'        TABLE<NA>
> 14               'Insurance co$'        TABLE<NA>
> 15             'Interest rates$'        TABLE<NA>
> 16                    'Motor V$'        TABLE<NA>
> 17           'Ostrich Projects$'        TABLE<NA>
> 18                   'Prop dev$'        TABLE<NA>
> 19                'tourism est$'        TABLE<NA>
> 20 'tourism est'$_FilterDatabase        TABLE<NA>
> 21              'Travel agents$'        TABLE<NA>
> 22               'Umempl stats$'        TABLE<NA>
> 23                     'US CPI$'        TABLE<NA>
>
>> mydata=sqlFetch(data, "AGR")
>> odbcClose(data)
>> mydata
> The printout doesn't look like the content of Excel spreadsheet.  Many data
> disappear.
>
> I read ?RODBC and the pdf file started with "RShowDoc("RODBC",
> package="RODBC").  I couldn't figure out the cause of problem.
>
>
> Is "RODBC" not the way to read Excel spreadsheets on R?  TIA
>
> B.R.
> Stephen L
>
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
>

-- 
Ivan CALANDRA
PhD Student
University of Hamburg
Biozentrum Grindel und Zoologisches Museum
Abt. Säugetiere
Martin-Luther-King-Platz 3
D-20146 Hamburg, GERMANY
+49(0)40 42838 6231
ivan.calandra at uni-hamburg.de

**********
http://www.for771.uni-bonn.de
http://webapp5.rrz.uni-hamburg.de/mammals/eng/1525_8_1.php



More information about the R-help mailing list