[R] RODBC: problem saving a new table in an "Excel database"

David Khabie-Zeitoune dave at evocapital.com
Mon Jul 21 16:30:00 CEST 2003


Hi

I am using package RODBC version 1.0-1 under R version 1.7.1 on Windows
XP Pro. I am having problems writing a new table to an (Excel) database
using sqlSave.

I connect to an empty Excel spreadsheet using odbcConnectExcel (which, I
believe, uses the Microsoft Excel Driver DSN). Then I try and save a new
table to the database(spreadsheet) using SqlSave, but obtain an error
message. 

Below is some test code which reproduces the error (assuming that
c:\test.xls is a standard "blank" Excel spreadsheet; i.e. Sheet1,
Sheet2, Sheet3)

> con = odbcConnectExcel("c:\\test.xls")
> df = data.frame(x = rnorm(10), y = rnorm(10), z = letters[1:10])
> sqlSave(con, df)
Error in sqlSave(con, df) : [RODBC] ERROR: Could not SQLExecute

Where am I going wrong?

Thanks,

Dave




More information about the R-help mailing list