String manipulation is not working if I try to write into excel

I extracted Humidity of a place from web as 91% . I have used str_Humidity.Substring(0,str_Humidity.Length-1) to eliminate %. It worked but when I try to write it in excel it is storing as 9100% please help.

saved as below into the excel:

Hi @rajeshmushini312

How this write line printing the value can you show that?


As long as your string is extracted as ‘91%’ you can simply do str_Humidity.Replace("%", "")
If that still outputs as shown in your picture, make sure the formatting on that cell is correct in the excel file.

I received this result using the above:

HI @rajeshmushini312

you can try this regular expression


it will match only numbers


you can try this way its working all

in the write cell you mention like this conditions

  1. str_Humidity.Replace(“%”,“”)

  2. System.Text.RegularExpressions.Regex.Match(str_Humidity,“[0-9]+”).Value


write cell condition like this


for reference you can see the output :-

Initially I tried this way as well, but still it prints the same way into the excel.
Later got to know that, that was an excel issue, I formatted the cell to text and it worked.

anyway Thank you very much !

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.