Skip to content

Excel Activities

Version: 1.0.0  ·  ID: zoan-packages-excel  ·  Author: Zoan Software

The Excel package reads and writes .xlsx files without having to have Microsoft Excel installed. It is one of the most used packages in automation: almost every office process goes through a spreadsheet — reading a list, filling out a template, consolidating data, generating a report.

Almost all activities accept one of two parameters to indicate which file to work on: path or session.

You pass the file path directly to the activity. This opens, performs the operation, saves and closes automatically. Ideal for loose operation.

Read Excel Sheet path = = asset("clientes.xlsx") → output: tabla

Session mode (session) — for various operations

Section titled “Session mode (session) — for various operations”

If you are going to do several operations on the same file, opening and closing it each time is slow. Instead, you open it once with Excel Open, get a session (ZoanExcelSession), and pass it to the other activities with session. In the end you close it with Excel Close (which saves).

Excel Open path = = asset("reporte.xlsx") → output: libro
Write Excel Sheet session = = libro sheet = "Datos" data = = tabla
Write Excel Cell session = = libro sheet = "Resumen" cell = "B2" value = = total
Excel Close session = = libro

You can read and write with three granularities, depending on what you need:

NivelReadEscribirFormato de datos
SheetRead Excel SheetWrite Excel SheetDataTable (with headers) — the most convenient
RangoRead Excel RangeWrite Excel RangeList of lists (raw values)
CellRead Excel CellWrite Excel CellA loose value
  • Cells: A1 notation — A1, B3, AA10.
  • Ranges: A1:D50 (from the top left cell to the bottom right).
  • Sheets: by name ("Datos") or by 1-based index (1 = first sheet). By default, the first sheet.
ActivityTypeOutputWhat it does
Excel Openexcel-openZoanExcelSessionOpen a workbook and return a session
Excel Saveexcel-saveSave the session to disk (or another path)
Excel Closeexcel-closeSave and log out
ActivityTypeOutputWhat it does
Read Excel Sheetexcel-read-sheetDataTableRead a sheet to a DataTable
Read Excel Rangeexcel-read-rangeListRead a range as raw values
Read Excel Cellexcel-read-cellobjectRead a cell
Get Sheet Namesexcel-get-sheet-namesListNames of all sheets
Get Used Rangeexcel-get-used-rangeDictionaryDimensions of the data area
Find Excel Cellexcel-find-cellDictionaryFind the first cell with a value
ActivityTypeOutputWhat it does
Write Excel Sheetexcel-write-sheetWrite a DataTable to a sheet
Write Excel Rangeexcel-write-rangeWrite values from a cell
Write Excel Cellexcel-write-cellWrite a value in a cell
Append Excel Rangeexcel-append-rangeAdd rows below existing data
Append Excel Rowsexcel-append-rowsAdd rows from a DataTable to the end (header only if empty)
Clear Excel Rangeexcel-clear-rangeClears the contents of a range or sheet

Read a list, process it and write a report:

Read Excel Sheet path = = asset("pedidos.xlsx") sheet = "Pedidos" → output: pedidos
For Each items = = pedidos itemVariable = fila
└─ activities:
... procesar cada pedido ...
Write Excel Sheet path = = "C:/salida/reporte.xlsx" sheet = "Resultado" data = = pedidos