How to Remove a Newline from an Excel cell using UiPath

I’m having trouble removing a newline from cells in an Excel column using UiPath. I’ve attached the Excel doc for reference.

I’m working on formatting the Departure Time and Arrival Time columns using UiPath. I believe the solution would involve using the Replace function, however I’m struggling to find how to use it properly to do what I need.

Can someone take a look at those columns in my Excel doc and explain how to manipulate a string using UiPath so I can remove the newline found in the Departure Time and Arrival Time columns?


Travel.xlsx (11.3 KB)

Hi @tmcwade12

  1. Use “Read Range WorkBook” activity and read the excel and store it in an data table say dtExcel.
  2. Use “For Each Row in Data Table” activity to iterate through each row in excel.
  3. Use the below two syntax in assign activity:
CurrentRow("Departure Time")= CurrentRow("Departure Time").ToString.Replace(vbLf, " ").Replace(vbCr, "")

CurrentRow("Arrival Time")= CurrentRow("Arrival Time").ToString.Replace(vbLf, " ").Replace(vbCr, "")
  1. Use “Write Range Workbook” activity to write the data table back to excel in new sheet.

Uploaded the workflow for reference:
Sequence10.xaml (8.9 KB)


Hope it works!!


Hi @tmcwade12

Try this

Input.ReplaceLineEndings(" ")


I hope it helps!!


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