[R] Updating a worksheet in Excel file using RODBC

Moshe Olshansky
Fri, 23 Mar 2007 08:06:38 -0000

Hello!

I have no problem reading Excel files (each worksheet in the file is a
"table" which can be read - at least in my case).

What I would like to do is to read such a table, change it (just the contents,
not the format) and write it back, and this I can not do.  I am getting the
following error messages (3 slightly different attempts):

> sqlSave(con, x, tablename = "Chimaera20_3years$", append = FALSE,
+         rownames = FALSE, colnames = TRUE,
+         verbose = TRUE, oldstyle = FALSE,safer=FALSE)
Query: CREATE TABLE Chimaera20_3years$  (Date varchar(255), 000Tax varchar(255),
1500Tax varchar(255), 3000Tax varchar(255), 4650Tax varchar(255))
Error in sqlSave(con, x, tablename = "Chimaera20_3years$", append =
FALSE,  :
        [RODBC] ERROR: Could not SQLExecDirect
37000 -3551 [Microsoft][ODBC Excel Driver] Syntax error in CREATE TABLE
statement.

> sqlSave(con, x, tablename = "[Chimaera20_3years$]", append =
FALSE,
+         rownames = FALSE, colnames = TRUE,
+         verbose = TRUE, oldstyle = FALSE,safer=FALSE)
Query: CREATE TABLE [Chimaera20_3years$]  (Date varchar(255), 000Tax
varchar(255), 1500Tax varchar(255), 3000Tax varchar(255), 4650Tax varchar(255))
Error in sqlSave(con, x, tablename = "[Chimaera20_3years$]", append =
FALSE,  :
        [RODBC] ERROR: Could not SQLExecDirect
37000 -3553 [Microsoft][ODBC Excel Driver] Syntax error in field definition.

> sqlSave(con, x, tablename = "[Chimaera20_3years]", append =
FALSE,
+         rownames = FALSE, colnames = TRUE,
+         verbose = TRUE, oldstyle = FALSE,safer=FALSE)
Query: CREATE TABLE [Chimaera20_3years]  (Date varchar(255), 000Tax
varchar(255), 1500Tax varchar(255), 3000Tax varchar(255), 4650Tax varchar(255))
Error in sqlSave(con, x, tablename = "[Chimaera20_3years]", append =
FALSE,  :
        [RODBC] ERROR: Could not SQLExecDirect
37000 -3553 [Microsoft][ODBC Excel Driver] Syntax error in field definition.

Am I doing it wrong way or is there a problem with the Excel driver?

Thank you in advance,

Moshe Olshansky
Chimaera Capital Group


Moshe Olshansky

Chimaera Capital Limited
Level 4 / 349 Collins Street
Melbourne, Victoria 3000
Phone: +613 8614 8400
Fax: +613 8614 8410
Email: molshansky@chimaeracapital.com

Disclaimer: This message is intended only for the personal and confidential use
of the designated recipient(s) named above. If you are not the intended
recipient of this message you are hereby notified that any review,
dissemination, distribution or copying of this message is strictly prohibited.
This communication is for information purposes only and should not be regarded
as an offer to sell or as a solicitation of an offer to buy any financial
product, an official confirmation of any transaction, or as an official
statement of Chimaera Capital Limited. E-mail transmissions cannot be guaranteed
to be secure or error-free. Therefore, we do not represent that this information
is complete or accurate and it should not be relied upon as such. All
information is subject to change without notice.



	[[alternative HTML version deleted]]