cancel
Showing results for 
Search instead for 
Did you mean: 

Error on OLEDB Execute stage

FrankieTEWV
Level 5

Hello,

I have an excel file in the xlsx format. I need to do a find and replace function so it finds all the comma's and replace it with a blank space.

I am using the OLEDB actions - the OLEDB 'Set Connection' and 'Open' action work - however i am getting an error on my 'Execute' stage.

The excel report has the below data in it and the commas are just in the 'Position Title' column - please note you wont see commas in my screen shot below as its just a snippet but there are commas in the data.

FrankieTEWV_0-1729678908540.png

My Execute SQL expression is 

FrankieTEWV_1-1729678939682.png

but the error i am getting is .....

FrankieTEWV_2-1729678963300.png

I then did a test and updated the OLEDB Execute SQL query to find all @ in the email column and replace with # 

FrankieTEWV_3-1729679012644.png

i got a different error this time 

FrankieTEWV_4-1729679072450.png

but when i checked the excel report it had changed all the @ in the emails to # .. so it did work but cant progress to the Close OLEDB action due to the pop up.

 

Can someone please help me find a solution to the execute SQL stage to find  the commas and replace with blanks in the Position Title column.

 

Thanks

Frankie

 

1 BEST ANSWER

Helpful Answers

Hi @FrankieTEWV 

With pleasure 🙂

for the SQL i forget to put the 'i' in Position so set it like this : 

"UPDATE [Sheet1$]
SET [Position Title] = REPLACE([Position Title], ',', '')"

For the connection, try to set it up like I did (just to test and see if it works)

Replace("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=***PATH***;Extended Properties=""Excel 12.0 Xml;HDR=YES;""","***PATH***",[ExcelFile]) 

 

please note that Excel 12.0 Xml is used for xlsx files (Excel 2007 and later) that are stored in an XML-based format.

View answer in original post

18 REPLIES 18

 

Hi @FrankieTEWV 

Can you try to put [Position Title] like this ?

I mean put square brackets

Let me know 🙂

your flow should look like this : 

 Mohamad_747_0-1729694242308.png

 

in set connection calculation stage put this : 

Replace("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=***PATH***;Extended Properties=""Excel 12.0 Xml;HDR=YES;""","***PATH***",[Path])

and store it in con like this : 

Mohamad_747_1-1729694304393.png

in execute : 

"UPDATE [Sheet1$]
SET [Postion Title] = REPLACE([Postion Title], ',', '')"

 

 

Thanks so much for responding, my connection calculation is this:

FrankieTEWV_0-1729697670087.png

the reason why i don't have "Excel 12.0 Xml" is because my excel doc is not xlsm, its a xlsx so ive used "Excel 8.0"  and the connection does work with that 

i got that from the below instructions 

FrankieTEWV_1-1729697886215.png

I did try adding the square brackets and copied your SQL you gave  ....

FrankieTEWV_6-1729698440014.png

 

but i get this error

FrankieTEWV_5-1729698406745.png

 

Hi @FrankieTEWV 

With pleasure 🙂

for the SQL i forget to put the 'i' in Position so set it like this : 

"UPDATE [Sheet1$]
SET [Position Title] = REPLACE([Position Title], ',', '')"

For the connection, try to set it up like I did (just to test and see if it works)

Replace("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=***PATH***;Extended Properties=""Excel 12.0 Xml;HDR=YES;""","***PATH***",[ExcelFile]) 

 

please note that Excel 12.0 Xml is used for xlsx files (Excel 2007 and later) that are stored in an XML-based format.

Hello,

Thank you Ive added the calculation stage and stored it in 'con' 

FrankieTEWV_6-1729765379590.png

 

I put the 'con'  in the connection string ... see below

FrankieTEWV_0-1729764713467.png

 and both the open and set connection actions worked ..

i updated the execute action as you advised

FrankieTEWV_1-1729764930528.png

but unfortunately still getting the error ..

FrankieTEWV_2-1729764997780.png

i checked the position title name on the excel report and could see the name as Position_Title see below ..

FrankieTEWV_3-1729765141703.png

so i did update the code to say Position_Title ...

FrankieTEWV_4-1729765199853.png

then got a different error ..

FrankieTEWV_5-1729765284003.png

Apologies I'm not sure if i needed the underscore in the Position Title or not but either way with it or without it I'm still getting errors.

Hi @FrankieTEWV 

Can you tell me which version of  excel are you  using? I did the same steps again on my pc and it works fine. I have already had a similar error in the past because of a special character hidden in the column. what I can suggest you try to test what you did on another excel file (create it and put only 3 columns with 3 rows) and run the script on it. if it works it means that there is a special character in your column that prevents execution

Hi Mohamad,

See below what version of excel i am using

FrankieTEWV_0-1729871892583.png

when using the OLEDB actions i had to install AccessDatabaseEngine 64 bit, however that didnt work with any OLEDB actions so i had to remove that and then install the AccessDatabaseEngine 32 bit and it worked .. im just wondering as the excel version i am using is 64 bit could that be why im getting issues?

FrankieTEWV_1-1729872266839.png

 



I will try your suggestion of creating my own excel file and run the script - il let you know how i get on - thank you so much for all your input and help its been so useful.

Morning,

I did my test excel ran the execute stage and it worked .. so you are right there must be some kind of special character in that collum on the excel report that is preventing execution.

Which would mean there would need to be a manual intervention on that report once downloaded to remove special character before the execute action could run.

I just want to say thank you so much for your help ive learnt a lot from this.

Thanks

Frankie

Hi @FrankieTEWV 

Whenever i get the error 'Datatype mismatch' it usually means the values Im trying to enter through oledb are different from the format in the cells I'm writing to e.g. writing text to cells that are formatted as numbers. Have you looked at the format on the cells you're updating to check they match what you want to do?