Skip to main content

I am trying to do an "UPDATE" statement using Excel as a DB on a cell in a column that is empty, but I am getting a syntactical error, how can I fix it?

 

@samlop Using Excel as a database is challenging. You're having to work through three layers of abstraction just to make it work. One of the side effects is that some of your SQL commands won't have the same syntax as before. This is an Excel as a DB problem, not an Automation Anywhere problem. 

You will have to experiment to figure out the syntax difference. 

Your other option is to import the Excel file into an Access database. Then, you can truly use the contents of the Excel file as a database without the abstraction and syntax issues. 


Hi ​@samlop ,

 

Could you please provide your UPDATE query here?


Hi ​@samlop ,

If you are having excel with No Column header, then used below connection string to connect excel as Database.

Provider=Microsoft.ACE.OLEDB.12.0;Data Source='<Excel_Path>';Extended Properties="Excel 12.0 Xml;HDR=NO";

 

Example:

If you use the select * query without WHERE clause, it shows like this:

F1 F2 F3
Nithish 9988564159 Male
Ganesh 9854237856 Male
Mahesh 9585453585 Male
Pranesh 9185453518 Male
Saanvi 8756128546 Female
Rajani 9185453583 Female

 

Then if you want to Update Nithish’s Phone number(F2) to “9999999999” 

Update rSheet1$$] Set F2="9999999999" Where F1="Nithish"

or want to Update Rajani (f1) Name as “RAJANI MR”

Update pSheet1$$] Set F1="RAJANI MR" Where F1="Rajani"

Select F1, F2 from lSheet1$$]

F1 F2
Nithish 9999999999
Ganesh 9854237856
Mahesh 9585453585
Pranesh 9185453518
Saanvi 8756128546
RAJANI MR 9185453583

 

This tells, how to update excel using SQL in AA  for non header records.

 

If this also not solving the problem, then please revert here with screenshot or data of excel template and what action you need to perform.

Thanks!


I am trying to do an "UPDATE" statement using Excel as a DB on a cell in a column that is empty, but I am getting a syntactical error, how can I fix it?

 

Try to paste the Update query in SQL server or whatever database you are using to remove the syntactical error (they may highlight in a red) and the use the query.


Reply