cancel
Showing results for 
Search instead for 
Did you mean: 

Find and Replace in Excel

SalmanShaik1
Level 5
Hi,
I want to replace some special characters like *,"" with Null in excel before doing further validations. Can you pl suggest me if there is any action available to do in Blueprism?

------------------------------
Salman Shaik
------------------------------
If I was of assistance, please vote for it to be the "Best Answer". Thanks & Regards, Salman Shaik
20 REPLIES 20

I feel the Execute Query action should be inside the loop  to replace the characters field by field.

------------------------------
Salman Shaik
------------------------------
If I was of assistance, please vote for it to be the "Best Answer". Thanks & Regards, Salman Shaik

Hi @Salman Shaik

Yeah! It's another posibility for this.

But I think that is slow to make +70 updates instance only 1. If is more clear for you, yes, you can put the Execute inside.

Here is the statement 

​"UPDATE [Sheet1$] SET " & [Collection Fields.Field Name] & " = REPLACE(" & [Collection Fields.Field Name] & ",'*','')"

Does this solve your problem completely?


See you in the Community, bye 🙂

------------------------------
Pablo Sarabia
Solution Manager & Architect
Altamira Assets Management
Madrid
------------------------------

Hi @PabloSarabia,
Is your previous logic(Placing execute outside the loop) also does the same replacement * with null with much speed than the logic suggested by me?
because i am not able to understand your precious logic thats why i am asking you several times.

can you pl elaborate more on your previous logic in calculation stage, execute stage
pl dont mind….


------------------------------
Salman Shaik
------------------------------
If I was of assistance, please vote for it to be the "Best Answer". Thanks & Regards, Salman Shaik

Hi @Salman Shaik

Both solutions make the same correctly.

The only different ​between these two solutions is the time that its takes to complete.

As I said in my previos post, is not the same to execute one update with all the fields than execute 70 updates with only one field. Of course, in both solutions you replace the *, but the second one takes several minutes to complete.

To ilustrate this, I make bigger my example Excel with 80 fields and 70.000 lines.

I duplicate my example to make as you suggest, the update inside the loop, and I take the time with two variables and the function Now()

Running the first one, one update outside the loop its take 30 seconds to be completed:
23338.png
Then I run your suggestion, the update inside, and it takes me more than 10 minutes.

23339.png
Why is this happening? Because if you go field by field you waste a lot of time opening and closing the command execution.Of course, my solution is not perfect, if you have too many fields in an update you may get the opposite effect and it may take longer.

Now is more clear?


Bye 🙂

------------------------------
Pablo Sarabia
Solution Manager & Architect
Altamira Assets Management
Madrid
------------------------------

Hi @PabloSarabia,

I have tried as per your suggestion but the validation is failed in execute query stage.
pl find the below screenshot for your reference



------------------------------
Salman Shaik
------------------------------
If I was of assistance, please vote for it to be the "Best Answer". Thanks & Regards, Salman Shaik

Hi @Salman Shaik

Humm... is strange...

In your column names do you have this character ( ' )?

If you can share in private the excel headers I will try to analyzed the problem directly


See you in the Community, bye 🙂

------------------------------
Pablo Sarabia
Solution Manager & Architect
Altamira Assets Management
Madrid
------------------------------

Hi @PabloSarabia,
I don't have any character(') in my column name. I just copy pasted the logic which you mentioned, while doing the validation its showing Missing " error. I feel the syntax of the query is wrong.
can you pl validate the query which you have posted from your end?

"UPDATE [Hoja1$] SET " & Replace(","&[SQL Statement Fields];",,";"")


------------------------------
Salman Shaik
------------------------------
If I was of assistance, please vote for it to be the "Best Answer". Thanks & Regards, Salman Shaik

Hi @Salman Shaik

I don't know if maybe the problem is if you ​have any space in the Column name, or any other special character.

I try to reproduce this in my local but I didn't get the same error.

Try replacing the calculation stage inside the loop for this:

[SQL Statement Fields] & ", [" & [Collection Fields.Field Name] & "] = REPLACE([" & [Collection Fields.Field Name] & "],'*','')"

The only different is that I encapsulate in square brackets the field name.

If the error persists, give in private the SQL that is executing or the Excel header to debug it better.


Hope this helps you!

See you in the Community, bye 🙂

------------------------------
Pablo Sarabia
Solution Manager & Architect
Altamira Assets Management
Madrid
------------------------------

Hi,
i am having issue with Execute stage not in calc stage. Can you please share the screenshot of execute stage logic. Its missing some " in the query so during validation its throwing error.

can you pl validate the execute stage and share me the logic.

------------------------------
Salman Shaik
------------------------------
If I was of assistance, please vote for it to be the "Best Answer". Thanks & Regards, Salman Shaik

Hi @Salman Shaik

Understood, I think that your problem was internally when you execute the SQL. Something like SQL syntax error or similar.

I don't understand why it's gives you this error

23411.png
Maybe something go wrong when you copy and paste

This is the text:

"UPDATE [Hoja1$] SET " & Replace(","&[SQL Statement Fields];",,";"")


I attach you the full process. Check it in your Blue Prism Solution


Hope this helps you!

Bye 🙂

------------------------------
Pablo Sarabia
Solution Manager & Architect
Altamira Assets Management
Madrid
------------------------------