Copy only table values to another DT

Attached the input file :
Input_File1.xlsx (13.2 KB)

How to copy only the table values ( highlited in RED) from whole sheet to another DT

Note : Table may start from any row in each download and number of rows also may change

Attached the expected output :

Expected_output.xlsx (11.1 KB)

Hi @Sathish_Kumar_S

Can you try this

Sequence7.xaml (55.2 KB)

Regards,

Hi @Sathish_Kumar_S

Workflow Steps:

  1. Use Excel Application Scope

Input: your Excel file path.

  1. Use ‘Read Range’ (Workbook or Excel)

Read the entire sheet into a DataTable (e.g., dtRaw).

Set preserve format to false.

Leave the range blank to read the whole sheet.

  1. Identify Header Row (Start of Table)

Use a For Each Row (Index Enabled) activity to scan for a known header.

If row(“Column1”).ToString.Contains(“Name”) AndAlso row(“Column2”).ToString.Contains(“Amount”)

When matched, store the index as startIndex.

  1. Extract Table Rows

Now filter all rows from startIndex to end.

Use an Assign activity:

dtTable = dtRaw.AsEnumerable().Skip(startIndex).CopyToDataTable()

This gives you the red-highlighted table into a new DataTable.
Try this one!

Previously i have attached the modified file and your code is works fine.

But it is not working when we use the Orginal downloaded file (attached the orginal file).

Can you check ?

Sourceability_Report_Ultimate_Duns_687967554_28-04-2025.xlsx (20.0 KB)

Hey @Sathish_Kumar_S can you try this using vba script

Sub CopyRedRows()
Dim ws As Worksheet
Set ws = ThisWorkbook.Sheets(1)

Dim lastRow As Long
lastRow = ws.Cells(ws.Rows.Count, 1).End(xlUp).Row

Dim i As Long, targetRow As Long
targetRow = 1

Dim cell As Range
For i = 1 To lastRow
    ' Check first 10 columns for red fill
    For Each cell In ws.Range(ws.Cells(i, 1), ws.Cells(i, 10))
        If cell.Interior.Color = RGB(255, 0, 0) Then
            ws.Rows(i).Copy Destination:=ThisWorkbook.Sheets("Filtered").Rows(targetRow)
            targetRow = targetRow + 1
            Exit For
        End If
    Next cell
Next i

End Sub

cheers

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