How to handle this exception for extracting column data on the basis of column name


#1

Hey,
I am facing an issue while getting the values of columns from datatable. Not able to extract the values on the basis of column name from datatable? it is throwing an exception that element not present in datatable although using same with excel sheet it is processing.


#2

Use header option is selected?
Check about whitespaces in columns name.


#3

use for each row in YourDataTable.Columns

use assign activity with below

YourDataTable.Columns(item.ToString).ColumnName = item.ToString.Trim

ExcelColumnIssue.xaml (7.7 KB)


#4

Not working…


#5

can you upload your sample application zip folder, so that I can help fixing it


#6

ABCL.zip (47.4 KB)

yeah sure. I am sharing zip folder and error while executing this task and data is extracted on the basis of column name but not able to extract values although if writing same datatable in excel sheet it writing accurately.


#7

Your PO MasterSheet (ERP-MT).xlsx is empty, and you are trying to read a column from it, and column name is having missing quotes “EAN No”


#8

I am reading values in a datatable “DTout” and from that datatable I am using get row item activity on the basis of which writing these values in PO Mastersheet(ERP-MT)


#9

Man your column names are different it is not EAN No in excel it is different, change the column name same in both places it will fine, I just tried it
Capture


#10

Let me know if it worked


#11

changed names accordingly still showing same error used with headers and without header both…


#12

ABCL.zip (44.8 KB)

Here is the working application. please download and use it.