[R] Import from excel 2007

kees chaogai at duineveld.demon.nl
Wed Oct 17 20:53:45 CEST 2007


For me, it works. That is to say, not the simple way, which gave the error:
odbcConnectExcel("C:\\Users\\Kees\\Desktop\\Map1.xlsx")

But it does when you ask the correct driver
odbcDriverConnect("DRIVER=Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm,  
*.xlsb);DBQ=C:\\Users\\Kees\\Desktop\\Map1.xlsx; ReadOnly=False")

It works correctly.

Cheers,
Kees

Op Wed, 17 Oct 2007 19:45:11 +0200 schreef Marc Schwartz  
<marc_schwartz at comcast.net>:

> On Wed, 2007-10-17 at 11:53 -0500, Earl F. Glynn wrote:
>> "Marc Schwartz" <marc_schwartz at comcast.net> wrote in message
>> news:1192550659.3526.20.camel at Bellerophon.localdomain...
>> > On Tue, 2007-10-16 at 14:38 +0100, Arnold Akem wrote:
>> >> Hey Seniors,
>> >>
>> >>   Really new to R, please has anyone imported a dataset from MS  
>> office
>> >> excel 2007 into R yet? It seem to be giving me hard times which I did
>> >> not expect as it use to go well with the previous versions.
>> >>
>> >>   Thanks in advance.
>> >>   arnoldo
>> >
>> >
>> > Office 2007 is using a new format (.xlsx, .docx, etc.) that is not yet
>> > compatible with most applications (including OpenOffice), since MS  
>> does
>> > not document it.
>> >
>> > The best thing to do is to save the Excel file as a .CSV file and then
>> > use read.csv() to import the data.
>>
>> Your question made me curious about RODBC and Excel, so I ran a test  
>> using
>> Excel 2007.
>>
>> Using RODBC (Version 1.2-1) with R 2.6.0 with Windows Vista, I cannot  
>> read
>> any of the new Excel formats, which there are three:
>>
>> .xlsx - Excel Workbook
>> .xlsb - Excel Binary Workbook
>> .xlsm - Excel Macro-Enable Workbook
>>
>> I get the same error for all three:  "ODBC Excel Driver Logic Failed:
>> External table is not in the expected format."
>>
>> When saving new Excel 2007 files, you can select "Save As" and "Excel
>> 97-2003 Workbook" and use those .xls files like before with RODBC in R.
>>
>> But be careful using RODBC and Excel, such as this problem:
>>
>> RODBC and Excel: Wrong Data Type Assumed on Import
>> http://tolstoy.newcastle.edu.au/R/help/05/11/14938.html
>
> This might be a question along the lines of "is it plugged in?", but do
> you have the Office 2007 version of the ODBC drivers installed?
>
> If not, then your results would not be a surprise.
>
> If you do, then we should get Prof. Ripley involved here, as we did have
> a brief offlist communication on this yesterday, thinking that RODBC
> "should" work if the proper version of the ODBC drivers are installed.
>
> Let us know.
>
> Thanks,
>
> Marc
>
> ______________________________________________
> 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.
>
>



-- 
Gemaakt met Opera's revolutionaire e-mailprogramma:  
http://www.opera.com/mail/



More information about the R-help mailing list