Detecting an undesired DataTable

Hey there,

I am working on a bot which scrapes a data table from a website. Sometimes this table has useful items in it which are required, but if there are no items then the value of ‘None selected’ appears there before being scraped.

I would like to find a way for the bot to detect this value and skip over this section. As you can see from the arguments, the value shows as [Column-0None selected], which I think might be what it thinks the column is called.

What would I need to write as an ‘if’ activity to get it to determine this?

Thanks for your help!


Hi @dr1992

You can use this dt.Columns.Contains(“Column-0None selected”)


Hey Anil, thanks for your reply. Unfortunately, this did not work. The ‘if’ didn’t detect this and instead went down the else section. It proceeded to type the item on column-0 into the website (“None selected”) and then errored when not finding column-1.

Any suggestions?

Hi @dr1992

Are you reading the headers ? if not then please try dt.Rows(0)(“Column-0”).Contains(“None selected”)

I previously was thinking you were reading headers and the value is in header


Hmm it is saying ‘option strict on disallows late binding’?

Hi @dr1992

what is structure of the datatable that you are using my assumption is Column-0 is the column name in Datatable and first row contains None Selected.

dt.Rows(0)(“Column-0”).ToString.Contains(“None selected”)

I missed .ToString. Please check the same


1 Like

How silly, I missed it as well!

That fixed it though, thank you so much good sir!

1 Like

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