Save the data to excel if element exists

hello,i have extracted the data from the web ,but some data is useful and some data is not useful,so i want to extract the data which is useful like it consists operating then data should be saved into excel if not it should return empty
can anyone suggest any method to do this

can i use regular expression

Hi @Manisha541,

1.First what you want to extract from the the data you got from the web, extract using the String split function or the regex functions.
2.Then store the resultant string in the excel…

3.If the extracted string length is 0 then dont write in the excel…


Yes @Manisha541, you can use

i had extracted the data from the web and eliminating the whitespaces i am saving into excel but some data it selects is useful data and some are not useful i want to save only the useful data into my excel

Can you show the data, so that i can suggest the methods to remove the not useful data…

If i search for coo name then some companies will show coo name exactly for some companies there is no coo ,I am using get text so it is selecting the data for every which is useful and which is not useful also so i want to save only data which is useful in excel

Can you please share the screenshot so that i can understand better?

this is my extracted data which saves in excel but some data doesnt contain what i need so i want to eliminate it

From this data which data do you need…?

Hi @Manisha541,

So after exacting data and storing it in String variable, you can simply use .Contains method in If activity, on that string variable to check, operating word is there or not
Like this,
and put sequence to store data in excel in Then section and leave else section empty

In else section i want to write into excel data not found which activity i can use @samir

Hi @Manisha541,

1.If you want to change in the particular column cell then try to use Write Cell .

2.If you want to write the entire row then use the add data row to that data table.


hey @Manisha541,

Add Data Row could be the better option here, for that, first of all use Build DataTable activity to create empty dataTable of 1 column.

And then use this If activity in your loop.


But parameter values should be different for those 2 Add Data Row.

Then Section —> image
Else Section —>image

Use write range activity (Out of the loop) with datatable variable dt to write datatable in excel.

thank you @samir ,i had solved it