18 January 2026:


This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.



Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.

Problem with Update Statement In EXCEL when variable has an apostrophe

edited November -1 in Sahi - Open Source
I am trying to update an element into an excel sheet. The problem is that the element has an " ' " in between which is restricting me from updating into excel.

CODE:

var $UpdateDB = "update [Sheet1$] set ItemName ='" + $Temp + "'" + " where RowNumber = " + $i ;
_alert($UpdateDB);
db.update($UpdateDB);

RESULT:
The statement is coming as :
_alert("update [Sheet1$] set ItemName ='$250 Ruth's Chris Steak House' where RowNumber = 6");


The "$250 Ruth's Chris Steak House" has a apostrophe(Ruth's) in the word so its not storing into excel. If the same $Temp doesn't have a apostrophe its storing to excel.


Can someone help me out

Comments

  • I am able to figure it out. I have made a replace to the apostrophe with Pipe Delimiter and used the substitute function in excel to convert it back to normal

    Thanks
Sign In or Register to comment.