How to extract complete row from the datatable one by one

Is there any way i can extract the complete row of excel at a time and if the row contains particular value i can extract the row location.

Case:

i am trying to extract the invoice details as per the header from this table, there are multiple copies of the bills in the same excel and data is unstructured.

Approach:
I wanted to extract each row value and then match the header, i have start and end header of the table, By that i wanted to extract a particular layout of the table and paste it in other excel.

If anyone can help me on this?

@predatorroxy_hgs

You could use Excel Lookup Range activity to find the first header cell the use Read Range activity from this cell to grab the data.

1 Like

Is it possible i dont open and operate on excel? can the same thing be done on datatable?

If you stick to UiPath’s activities, you have Read Row activity under System > File > Workbook. Use it into a DoWhile activity to iterate over your file’s rows and break whenever you find your value.

Assign (String)
Searched = "DOC No"

Assign (Int32)
RowIdx = 0

Assign (String)
ColumnLetter = ""

DoWhile String.isNullOrEmpty(ColumnLetter)

  • Assign
    RowIdx = RowIdx + 1

  • ReadRow
    StartingCell = "A" & RowIdx.ToString
    Result = Row

  • ForEach Cell in Row
    Index = ColumnIndex

    • If Cell.ToString.Trim = Searched

      • Assign
        ColumnLetter = Chr(Asc("A"C) + ColumnIndex)

      • Break

Assign (String)
FirstCell = ColumnLetter & RowIdx.ToString

Thanks @msan!!
i used similar logic to build the code to solve it.
i first read the complete excel for count of occurrence of “DocNo”

Then i have divided the excel into that many partitions based on the location of docNo and then extracted the value of sub table in a data table.

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