Importing .xlsx files using rxImport()

Problem
Is there a way to import .xlsx Excel files using rxImport(). rxImport() has ODBC functionality.
Solution
This may be possible if you can setup the proper ODBC connection string and express a correct query but it has not been tested. I will need to investigate whether this is supported. Are you able to verify you can connect to and query the Excel spreadsheet via ODBC outside of R? Can you provide the entire script you are trying to run as well as what version of Excel you are running.

If this will not work with rxImport, an alternative would be the RODBC package which does have more direct Excel/ODBC support. This would bring the Excel spreadsheet into a data frame which could then be written to an XDF file.

Here is a short general example for importing an Excel workbook into an .xdf file:

sConnectionStr <- "Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DriverId=790;Dbq=C:/Data/ODBCTest.xlsx;DefaultDir=c:/Data;" testExcel = "SELECT * FROM [Sheet1$]" excelDS<- RxOdbcData(sqlQuery = testExcel, connectionString=sConnectionStr) excelDS_XDF<- RxXdfData("testFromExcel.xdf") rxImport(excelDS, excelDS_XDF, overwrite=TRUE)
Note This is a "FAST PUBLISH" article created directly from within the Microsoft support organization. The information contained herein is provided as-is in response to emerging issues. As a result of the speed in making it available, the materials may include typographical errors and may be revised at any time without notice. See Terms of Use for other considerations.
Properties

Article ID: 3103839 - Last Review: 11/01/2015 15:29:00 - Revision: 1.0

Revolution Analytics

  • KB3103839
Feedback