Write multiple lines within a cell

Hello Community,

I would like to write multiple lines within an excel cell. Is that possible in UiPath? If so, how should I prepare my data table in this case?


Hi @Joshikumarav

You can use Environment.NewLine to create new line that will be saved to the Excel.
This is how you would add a row with two lines to a single column DataTable:

1 Like

You can use Environment.NewLine or vblf or vbNewline.

Hello -

Is using the Environment.NewLine in theory how I could read from a data table?

I have an excel cell that contains two lines of text. Example:

“New description without (acct) and
Commas are not allowed”

I’m using the ‘Add Data row’ activity and want the original data into a new DT. While looping, I can not add the column header “New description without (acct) and Commas are not allowed” to the new DT. When I debug, I see the column I need, however, I can not access it. I’ve tried:

row.Item("New description without (acct) and " + Environment.NewLine + “Commas are not allowed”).ToString

The column changes position or else I would use that.

Thanks in advance for your help!

I found the solution using vbLf:

row.Item("New description without (acct) and "+vbLf+“Commas are not allowed”).ToString