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
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.
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
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’
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”)