Skip to main content
Solved

How to remove single quote in excel rows data.

  • June 10, 2025
  • 4 replies
  • 60 views

Forum|alt.badge.img+1

Hi,

I need to insert data in sql server from excel data.

 Excel rows data having single quote in between values. because of that it is not update in sql server.

can anyone help on this.

 

Thanks

Best answer by Aaron.Gleason

@babu 3365 Perfect. Thank you!

The data you’re showing has items like Sai’s and Paul’s. When using these in SQL commands that also use apostrophes to enclose strings, this is causing a problem.

insert into users (lastname, firstname, id) values ('Babu', 'Sai's', 123234);

One way to perfect the data before inserting into the database is to replace the apostrophes with two apostrophes with something like the String: Replace action:

Since you’re reading from an Excel file, you can replace the Source string with your record variable, e.g., $rExcelRow{“First Name”}$

This should prevent your SQL command from not working due to apostrophes. This will need to be done on any column that would potentially contain an apostrophe.

4 replies

Aaron.Gleason
Automation Anywhere Team
Forum|alt.badge.img+14
  • Automation Anywhere Team
  • June 10, 2025

Please share some sample, anonymized data here and we might have a better idea of how to help.


Forum|alt.badge.img+1
  • Author
  • Cadet | Tier 2
  • June 10, 2025

Hi ​@Aaron.Gleason ,

Please find the attachement.

 


Aaron.Gleason
Automation Anywhere Team
Forum|alt.badge.img+14
  • Automation Anywhere Team
  • Answer
  • June 10, 2025

@babu 3365 Perfect. Thank you!

The data you’re showing has items like Sai’s and Paul’s. When using these in SQL commands that also use apostrophes to enclose strings, this is causing a problem.

insert into users (lastname, firstname, id) values ('Babu', 'Sai's', 123234);

One way to perfect the data before inserting into the database is to replace the apostrophes with two apostrophes with something like the String: Replace action:

Since you’re reading from an Excel file, you can replace the Source string with your record variable, e.g., $rExcelRow{“First Name”}$

This should prevent your SQL command from not working due to apostrophes. This will need to be done on any column that would potentially contain an apostrophe.


Forum|alt.badge.img+1
  • Author
  • Cadet | Tier 2
  • June 11, 2025

Thanks ​@Aaron.Gleason 

I will check this scenario.