How to scrap only one row from a table?

I have a table from which I have to scrap a single row using data scraping. How can I achieve this?

Scrap the data, retrieve it in a string. Then split the string to gain the content you actually need.

@vivek_Chowdary,

Use Data Scraping to read table and will give you output as DataTable and say ‘DT’.

To read first row from DataTable - DT(0)

1 Like

@lakshman I need to extract the row where Year = 2018. How can I do that?

@vivek_Chowdary

If it is possible, you can try like this way also

row = dtTest.AsEnumerable.FirstOrDefault()

Thanks,

Pradeep Sridharan

@vivek_Chowdary,

Try below one:

DataTableName.select("Year = ‘2018’ ") - It will give you array of data rows as output.

@vivek_Chowdary You can use for each row activity then use if activity to choose what row of the table you want to get. Sequence.xaml (8.8 KB)

@lakshman Its not working. I am getting the following error:

I am trying to get the row with year=2018 from that table above.

@vivek_Chowdary,

Follow these steps:

  1. First scrape Data from Website and will give you output as ‘DT’.
  2. Then apply filter - DT.select("Year = ‘2018’ ").copytodataTable and store output in variable of type DataTable and say ‘NewDT’
  3. Then use Output DataTable activity to convert dataTable to string and pass NewDT here. Then display output string using message box.

@lakshman I am still getting the above error!!

@vivek_Chowdary,

Could you please share your workflow with me and need to check once.

These should work.

  1. Scrape Data then save sa DataTable
  2. Use For each row activity to iterate each row
  3. Use if activity inside the body of For each Row
  4. Input these as the condition --> row(“Year”) = “2018”
  5. Inside then use assign activity to assign the values of the rows. (e.g. row(“mat”).ToString, row(“Inns”).ToString and so on)

Hope this helps

yes sure

@lakshman PS3_Final_Project.zip (25.0 KB)

@vivek_Chowdary

Please find the attached workflow. Here, Column name is ‘Year’ but you used ‘Column-0’. I changed now. Please run it and let me know. I am not able to open this site because my company blocked it.

PS3_Final_Project.zip (26.6 KB)

@lakshman Nope, it isn’t working. Same error.

@vivek_Chowdary

After scraping data and write into excel file and send me once.

Player Stats.xlsx (9.4 KB)

@vivek_Chowdary

I tried its working for me. Please find the attached file. Here, I am reading input data from excel and then filtered it and displayed. Run it and check once.

Main.xaml (34.9 KB)

Note: Just change the file path in Excel application scope and run.

no it isn’t working on mine.