How to Find Start with A rows in Excel

I have a Excel sheet 1, i want to find start with A rows to store in sheet2.

Can you please suggest me
thank you

@jaranrikki_17

share the input and expected output.

@jaranrikki_17

if you want to check for particular column use this

dt.asenumerable.where(function(r) r(“columnName”).tostring.startswith(“A”)).copytodatatble

to check all the row values use this

dt.asenumerable.where(function(r) r.itemarray.any(function(a) a.tostring.startswith(“A”))).copytodatatble

1 Like

Did u try with Balareva excel activity from marketplace
Here is an activity called “Find”. it will return the cell info and row index as an array. So the last element is the last index.

@jaranrikki_17

Example:

image

@jaranrikki_17

Try this Linq

(
From row In DT
Let a = If(row("Column Name").tostring.startswith("A"),"Yes","No")
Select DT2.Rows.Add(row("Column Name"),a)
).copytodatatable

refer the above post or use the below query

dt.AsEnumerable.Where(Function(r) r(0).ToString.StartsWith(“A”)).CopyToDataTable

1 Like

@Shiva_Nikhil

I have tried this linq query but getting some error

Hi @jaranrikki_17

Try this

Code:

(From row In DT1.AsEnumerable()
              Let name = row.Field(Of String)("ColumnName")
              Where name.StartsWith("A", StringComparison.OrdinalIgnoreCase)
              Select row).CopyToDataTable()

I/P:
image
O/P:
image

Hope this helps!!

1 Like

@jaranrikki_17

can you share the error screenshot

with the sample input i have excuted

if you are copying and pasting the code you will get error,

if so please type the code and check once

1 Like

@Dilli_Reddy
yeah its working thank you.

1 Like

Thank for the reply @Shiva_Nikhil @lrtetala @Palaniyappan

2 Likes

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