Extract HTML Table from nth Row using Data Scrapping in UiPath

This is the LINQ to convert XML into DataTable

(From x In xDoc.Descendants("tr")
Let ra = x.Descendants("td").Select(Function (c) c.Value).ToArray
Select dtOut.Rows.Add(ra)).CopyToDataTable

The column with header as Amount needs to be in Int32 format but the output in the datatable is in String format and when writing to excel it keeps the String format. But I need that column to be in Int32 format in Excel to be written. The Amount Column will never have empty value.

I have tried to make the Amount column as Int32 while building the data table, but while converting the XML to datatable it generates error "Input string was not in a correct format.Couldn't store <10.00> in Amount Column. Expected type is Int32." where 10 is the value of the first row in Amount Column.

unfortunately the questions are not fully answered.
The first line n datatable is data or header names?
what are the columns (best: share a sample row with its data with us)

I have attached the sample data for first two rows. While building the data table, I have created the same columns and ignore the TH tag in the LINQ. So the data table is perfectly generated. Now need to convert the values of the Column named as Amount to Decimal with 2 places for the whole table. Can not run into loops as the table has 90000+ rows, so need some fastest way to do it.

Hope it answers your question, let me know if you need any other information.

The issue is resolved after using Change Column DataType activity from BalaReva.EasyDataTable.Activities.

Finally my problem is solved. Thank you @ppr so much :slight_smile:

would suggest to make extraction and conversion independend
run with a second cleansing & conversion over extracted data and convert amount to an additional column
afterwards unneded columns can be removed and datatable can be adopted on col names and positions

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