How to read only numerical items in a excel column, we should remove the items, if it contains any alphabets in it. Before adding the items into queue

Hi,

My data in Excel Column is in the format " Number(Column Name) - 1-8432633658(Values) " .

And My doubt is if any item has format like " 1-826455836ghdv " .

Alphablets may appear anywhere like “1-rhu34835hv3” .

Then I have to remove that item from my database. So that I can add the items which has only numerical values in the orchestrator queue.

I know that we can use filter data table to filter the required data. But I don’t know exactly what to do there.

Could anyone please help me.

Hi,

Hope the following expression helps you.

filteredDt = dt.AsEnumerable.Where(Function(r) not System.Text.RegularExpressions.Regex.IsMatch( r("Values").ToString(),"[^\d\-]")).CopyToDataTable

This will filter out row which contains except number and dash in Values column.

Regards,

1 Like

Hi Yoichi,

Thank you for your information…Can you please explain it briefly where to use…

Hi,

How about the following step?

  1. Read source data using Read range
  2. Filter datatable using the above expression
  3. Write filtered datatable to another sheet.

img20210108-4

Regards,

1 Like

Hi Yoichi,

Cheers! It works… Thanks for the help…

1 Like

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