Cut, Copy rows in Excel that are starting with numbers in Column ‘A’ and paste in another excel and then delete the empty rows from the previous excel.
Cut, Copy rows in Excel that are starting with numbers in Coulmn 'A' and paste in another excel and then delete the empty rows from the previous excel
Can you share some dummy Excel File with input and output sheets.
2 to 3 rows would be sufficient.
- Read the data into datatable dt
- Use for each row in datatable activity and assign a variable to index in the for loop properties
- Inside that use the condition if to check if the first cell contains number
- On then isde use copy range and give range as
"A" + index.ToString + "G" + index.Tostring(change the G as per the column you need in excel)
- Then use delete rows with same range as above or give the row number which is
Sample File.xlsx (48.1 KB)
You can use this expression:
dtRecords.AsEnumerable.Where(function (x) (x(“REPORTING_PAYROLL”).ToString).IsNumeric=True).CopyToDataTable
Here’s the sample workflow and the file(you can check the output sheet:
Sample File.xlsx (46.3 KB)
ExcelRowFiltering.xaml (5.7 KB)
In case if this serves your purpose please mark this as solution!
Thanks for the solution, It worked except for one row. It didn’t appear in the output sheet:
Sorry I misunderstood the requirement a bit,
Here’s the updated sequence and file with output sheet
ExcelRowFiltering.xaml (6.3 KB)
Sample File.xlsx (46.4 KB)
Expression updated to:
dtRecords.AsEnumerable.Where(function (x) System.Text.RegularExpressions.Regex.IsMatch(x(“REPORTING_PAYROLL”).ToString.Trim.Chars(0).ToString,“[0-9]”)).CopyToDataTable
Hope this helps!
That was fast Thanks. This solution helped and gave the required output !
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.