Get value from column header

Hello all,

How can I get value from column header as below. Thank all
Column A Dynamic Column DC DC DC DC
ITEM No. (MM),(OD X MM) - (PC),(PCS),(PCS.) - (KGS),(MT) - (USD/PCS) - AMOUNT

Hi @anh.nguyen,

Your question is not clear. Do you need all headers in string format?

If yes below expression would help.

Join(“,”(From dc In InputDt.Columns.Cast(Of DataColumn) Select dc.ColumnName).ToArray())

Regards,
Harshith

1 Like

Hi,

I want to get all values ​​under desired header columns. That columns dynamic so some name not changes
Col A - - - - - - - Dynamic Column
ex: ITEM No. - (MM),(OD X MM) - (PC),(PCS),(PCS.) - (KGS),(MT) - (USD/PCS) - AMOUNT

1 Like

Anyone help me get value from the column header as below?

Hi @anh.nguyen ,

I assume you use activity read range with not providing specific range to read (“”).
For this case, you can yous below solution step :

  1. Read range activity with no range “” and output variable is DtRead
  2. Use Assign activity and create variable (GenericValue/Integer) CountDataRange = DtRead.Rows.Count.ToString
  3. Use Assign again CountDataRange=CountDataRange+1
  4. Use Read Range with range “A2:X”+CountDataRange.ToString
  5. Try to check output from step no 4.

Regards,

1 Like

Hi,
It copy all INV sheet, I just copy data from row have Cellname: “Item No.” to lastrow of table


Hi @anh.nguyen ,

In that case you can read range no 4 with “A2:A”+CountDataRange.ToString

Regards,

@anh.nguyen

  1. put all the column headers you want in a list e.g. filterList (this can be a dynamic list)
    e.g. {“item no.”, “discription of goods (mm)”, “quantity(pc)”…}

  2. read datatable from excel e.g. to variable called dt

  3. assign New DataView(dt) to a dataview variable
    assign dataView.ToTable(false, filterList.ToArray) to filteredTable variable

now your filteredTable variable will be a table with only columns you want!

Hi @aliaga
Sorry I not explain clearly, my mean copy for Cellname" ITEM No." to last row (col R or AZ…) but last Col has title AMOUNT

can you just standardize all the columns to be the same

do foreach loop on dt.copy.columns

  • if column.columnNname.contains “Discription” then assign
    dt.Columns(currentItem.ColumnName).ColumnName = "Discription"

and so on…

so now your columns will be the same “DISCRIPTION OF GOODS”, “QUANTITY” etc…

Sequence3.xaml (11.0 KB)

1 Like

Hi @jack.chan

Please help me review workflow & excel file. When I run have error: Assign: Column ‘Item No.’ does not belong to underlying table ‘DataTable’.

Sequence3.xaml (20.5 KB)
SSC-2023-145 AWAJI.xlsx (176.5 KB)

1 Like

@anh.nguyen change this to A22

Hi,

Problem I have a lot of INV sheet from Customer so don’t know exactly start Row? just know Name cell: Item No.

use this then i added logic to read from dynamic row @anh.nguyen
Sequence3.xaml (28.3 KB)

1 Like

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