Not able to get Column Name in Extract Data Table

Hi All,

I am trying to scrape data using Table extraction . But I am getting headers as Coulm -1 , Column-2 instead of Column Name. The column name is fetching below as


Actually I want just the column Names like Accounting BOOK, DATE etc. Here its fetching Column-0, Column-1 dute to which I am getting the error.


Hi,

Can you try as the following? This renames columns using items of the 1st row then remove the 1st row.

currentItem.ColumnName=ExtractDataTable.Rows(0)(idx).ToString

Regards,

Hey,

So when you are scraping instead of scraping the entire table at once scrape column by column there you get the flexibility of using custom names to columns.

After you scrape one column, go for Extract Co-related data from the scraping wizard.

Hi @dutta.marina

Click on the highlighted logo and Change the name as per your requirement.

Thank you…

Hi @dutta.marina

When you are extracting the datatable. The column names are not extracting it was extracting the column names as row. Please find the below solution for your Querey.

Use a for loop with dt.Columns and change type argument to datacolumn

Inside the loop use currentitem.ColumnName = dt.Rows(0)(currentitem.ColumnName).ToString

After the loop use assign to remove the first row as below dt = dt.AsEnumerable.Skip(1).CopyToDataTable

Or use remove data row activity

Hope this helps!!

Hi @mkankatala

Thanks for the solution. My next step is to fetch the column Date and find the max date as sometimes there will be multiple dates .

Hence after that I am using again for each row in DataTable and using the expression max_date =ExtractDataTable_Invoice.AsEnumerable.Where(Function(r) DateTime.TryParseExact(r(“DATE”).ToString,“MM/dd/yyyy”,System.Globalization.CultureInfo.InvariantCulture,DateTimestyles.None,New DateTime)).Max(Function(r) DateTime.ParseExact(r(“DATE”).ToString,“MM/dd/yyyy”,System.Globalization.CultureInfo.InvariantCulture,DateTimestyles.None)).ToString(“MM-dd-yyyy”)

But I am getting error "Sequence contains no elements’

Hi @Yoichi

Thanks for the solution. My next step is to fetch the column Date and find the max date as sometimes there will be multiple dates .

Hence after that I am using again for each row in DataTable and using the expression max_date =ExtractDataTable_Invoice.AsEnumerable.Where(Function(r) DateTime.TryParseExact(r(“DATE”).ToString,“MM/dd/yyyy”,System.Globalization.CultureInfo.InvariantCulture,DateTimestyles.None,New DateTime)).Max(Function(r) DateTime.ParseExact(r(“DATE”).ToString,“MM/dd/yyyy”,System.Globalization.CultureInfo.InvariantCulture,DateTimestyles.None)).ToString(“MM-dd-yyyy”)


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