Skip to content

Win Extract Table

Type: win-extract-table  ·  Package: Desktop Activities v1.0.8  ·  Output: DataTable

Extracts the data of a table or grid in a desktop application (.NET DataGrid, Java JTable, ListView…) and turns it into a DataTable. It is far more efficient than reading cell by cell: one activity brings you the whole table, ready to process or dump into Excel.

It locates the grid by its selector and reads its rows and columns, without clicking or scrolling it:

  • Rows: every row (UI Automation DataItem or ListItem) inside the grid, up to maxRows.
  • Cells: the texts of each row’s controls, in order. If a row has no separate cells, its whole text becomes a single column.
  • Columns: with includeHeader = true, their names are the headers the grid exposes; without headers (or with includeHeader = false) they are named col0, col1, col2…, based on the number of cells in the first row.
  • In Java applications (JTable) the table is read through the Swing bridge, with its headers.

Every value arrives as text, exactly as shown in the grid. Rows with fewer cells than columns are filled with "".

ParameterTypeDefaultDescription
selectorselector—The table or grid.
ParameterTypeDefaultDescription
sessionZoanDesktopSession—Win Attach session. Inside a body it is taken automatically; without a session, the selector must include the window.
includeHeaderbooltrueUse the grid’s headers as column names. With false, columns are named col0, col1…
maxRowsint500Maximum number of rows to extract.
timeoutnumber30000Maximum ms to wait for the grid. Empty = the project’s UI timeout or, if not set, 30000.

Returns a DataTable: one row per grid row and one text column per column. If the grid is empty, it returns a table with no rows (not an error).

MessageCause and fix
Element not found with selector {…}.The grid did not appear within timeout. See common errors.
The Java control could not be located unambiguously, so nothing was done. …In a Java app there are several identical tables. Add an anchor or an idx to the selector.
Duplicate column errorTwo grid headers have the same text and can’t both be column names. Use includeHeader = false and rename the columns afterwards.
Win Extract Table selector = (grid "Transactions") → output: transactions
Log message = "Rows extracted: " + rowCount(transactions)
For Each items = transactions itemVariable = row
└─ activities:
Log message = str(row["Date"]) + " — " + str(row["Amount"])