I have an Excel table. In one of the columns, the text is, for example, ‘0000000011111111’. How can I replace the first ‘0’ with ‘4’, so that it becomes ‘4000000011111111’?
- Excel Application Scope
- Read Range
SheetName: Name of the sheet containing the data
Range: Range of the data to read
Output: dtTable (DataTable) - For Each Row
Input: dtTable - Assign
To: row(“YourColumn”)
Value: System.Text.RegularExpressions.Regex.Replace(row(“YourColumn”).ToString(), “^0”, “4”) - Write Range
SheetName: Name of the sheet to write the data
Range: Range where you want to write the modified data
Input: dtTable
Hope it helps!!
Try this:
Use a “For Each Row” activity to iterate through each row of the DataTable.
In Assigin: row(“ColumnName”) = row(“ColumnName”).ToString().Replace(“0”, “4”,1)
It will replace the first “0” value.
Hope it helps.
Hi
Assign: row(“ColumnName”) = row(“ColumnName”).ToString().Replace(“0”, “4”, 1)
Thanks
Read Sheet and shore in DT
Put for Each over DT
inside for loop put if, If is to check number first letter is zero or not and put condition->
If row("ColumnName").ToString().StartsWith("0") Then
put Assign activity inside then block and put like this->
row("ColumnName") = "4" & row("ColumnName").ToString().Substring(1)
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.