Special Characters added in excel

Hi Team,

I have an excel with Name column - Partner - Reading in DT1

Doing some manipulations using linq In DT1 and writing the same name in an another sheet it is writing Name column as “Partner[somespecialcharacter]” - not sure why one special character is added. I removed space in DT and again ran the bot now the same partner value copied without any special character. How to handle this issue?


There may be a hidden special character in the Excel spreadsheet. To handle this, you can use the following regular expression to clean the header data:

MyHeader = System.Text.RegularExpressions.Regex.Match(MyHeader, "([A-z]*\s*)+").Value

This replaces everything in the header except for A-z characters (upper and lower case) followed by any number of spaces.

1 Like