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?

Thanks,
Joshi

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!
Brad

I found the solution using vbLf:

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

2 Likes

Hi,

This is ok but how could manage if the result is a text with many lines and I want to extract each one as a diferente field?

Example:

DataRow 
{
  HasErrors=false,
  ItemArray=object[1] 
  {
    @"0,55 €
2,75 €/kg
Salchichas 200 g.
Añadir" 
  },
  RowError="",
  RowState=Added,
  Table=[] 
}

Value of

  • 0,55 € is a field;
  • 2,75 €/kg is another field;
  • Salchichas 200 g., is another field
  • Añadir is the last one which I wnat to delete it.

I really appreciate your comments.

Thanks