Reputation: 37
I am trying to read an Excel file with odbcConnectExcel2007
function from RODBC
package. It works fine when the file is not in use. But when it is, I get the error:
Warning messages: 1: In odbcDriverConnect(con, tabQuote = c("[", "]"), ...) : [RODBC] ERROR: state HY000, code -1028, message [Microsoft][ODBC Excel Driver] Cannot open database '(unknown)'. It may not be a database that your application recognizes, or the file may be corrupt. 2: In odbcDriverConnect(con, tabQuote = c("[", "]"), ...) : ODBC connection failed
I have also tried to include readOnly = TRUE
in the function specification, but still no luck. Any ideas anyone?
Upvotes: 2
Views: 650
Reputation: 23014
Try using the read_excel()
function from the readxl
package - it will allow you to read an Excel file into R while the file is in use.
Upvotes: 2