Trouble Reading excel column

Hello everyone,

I am unable to read a column in excel with ‘Column Name’
The problem is, My column name has Newline in it.

cell

e.g. row(“First Name”).toString does not work
row(“First”+environment.Newline+“Name”).toString does not work

P.S. I do not want to use Index.

1 Like

Are you using excel scope? You could read range and put the data in a DataTable, then print the names of the columns and you will see how are the names.

Probably that could help.

I did that,
I printed the column names.
I can see them in different lines.
I don’t know how to read the value using column name.

could you share an example of your excel?

you could use the replace method to remove the new lines from the column names first…is editing the column names an option?

RemoveNewLines.xaml (4.9 KB)

2 Likes

well I found the problem but dont know the solution … I did your scenario … and I get when I printed the column name as:

“First \nName” but with if I put enviroment.newLine as you did I got … ‘First \r\nName’ so the difference is \r .

1 Like

I left for the day… I will surely use both of your helps tomorrow…
Thank for taking your time out for me.

@ronanpeter yes editing the column name can be done. Your way looks like an alternative. I will update you once I try.

@carmen so you mean ‘\n’ works and ‘\r\n’ does not? Did ‘\n’ work for you?

yes, if editing the name is a option, you can use the solution of @ronanpeter that will replace the \n and you will have your columns names as you want.

1 Like

Thank you both for your help.

I designed it by the way @ronanpeter has suggested.
Works well!

Thank you again for your time.

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