How to access column name which split to next line in cell?

Hi Team,
I have 1 excel which having columns like S/N, Name, Product name Prod1 etc.(attached screenshot)
How to access particular column(Product Name product 1) which is splited to next line in cell?
excel

2 Likes

@Komal_Mehetre

Did you try to access column name using Environment.Newline ?

Hi @Komal_Mehetre - Try something like this “[Product Name product 1]”

Thanks,
AK

Have you tried with “Get Cell” Activity?

1 Like

If you know its position, you can use the index value:
so Table.Rows(0).Item(2)

1.) use get cell activity Or
2.)if you know row index use syntax like datatable_varile[row_index][column_name]

please tell me know exact requirement so that we can help out me clearly

@ShilpiJ
can you please explain how to access it using Environment.Newline?

@AnandKumar26
I have already tried it says this column does not belongs to the table.

@Parth.Kadia
I am not able to find any get cell activity.

Try to print the value of that cell by giving row and column index. See the output then we can take decision accordingly.

Thanks,
AK

I can’t use index as i have 40 columns from that i have to select 10 and in future if any column deleted then it will affect other column’s index

@AnandKumar26
when I have tried using index it show result as Product Name\n product 1

For “Get Cell” Activity you want to install Package “Uipath.Excel.Activities”

@kalyanDev
I have excel which has column name(Product Name product 1) splited in 2 line (attached screenshot)
I wanted to access that column using column name in for each row. I can’t use index as in future column position may change.
So please provide me solution to access column name which has 2 lines in single cell?

Do you have column name like shown in below excel file?

Test.xlsx (8.3 KB)

Hi @Komal_Mehetre - I think you read the header row, then format accordingly for BOT readable format and re-write the header row again into the excel sheet. And then you can start your actual process.

Thanks,
AK

One way to do it is to locate the index of the column,

You can use a For Each loop of all of the columns
Then within that use an if statement to find the colum name that contains your string header (Product Name product 1) THEN
set the column index by assigning an interger to item.Ordinal.

You would then access it via the solution i previously suggested.

row(“Product Name”+vblf+“product 1”).ToString

try this

3 Likes

@ImPratham45 Thank you. This is working for me.

1 Like

Welcome!!! :blush:
can u please mark it as solution