I ran into a small problem,
I have datascraped a website and have saved the data to a csv file.
The csv file contains 1 column called ‘Sale’ (header) the data under this contains a 10%
example of how the Csv looks:
Sale
10 %
My question is, How can I get ride of the (spacebar) and %
1.Read the csv to a datatable.
2.Inside the for each row activity for datatable,
assign, row("Sale") = System.Text.RegularExpressions.regex.Replace(row("Sale").ToString,"\s?%",string.Empty)
3. Write the datatable to file.
Sorry, I don’t noticed this.
Please find the workflow Remove_%_in_cell.xaml (6.7 KB)
and just change the filepath of ‘Read CSV’ and ‘Write CSV’ activites with your files.
I hope you know about reading csv file to datatable and writing it back.
The expression row("Sale") =System.Text.RegularExpressions.regex.Replace(row("Sale").ToString,"\s?%",string.Empty)
This regular expression checks for the presence of ‘space(optional) followed by % ’ in each cell under the header ‘Sale’ and replace it with a null value. Thus the ’ %’ will be deleted.
I hope you got it. Feel free to ask If you have any doubts. Happy automation.
Yes. It is possible. Please replace the ‘Write CSV’ activity with “Append To CSV” activity and use the same file name. It will append the values on each execution.