Get Excel Used Range
Get Excel Used Range
Section titled “Get Excel Used Range”Type: excel-get-used-range · Package: Excel Activities v1.0.0 · Output: Dictionary
Returns the dimensions of the area containing data on a sheet (the “used range”). It tells you how many rows and columns there are and where they start and end, without having to read the entire content. Useful to know the size of the data before processing it, or to construct a dynamic range.
How it works
Section titled “How it works”Calculates the minimum rectangle that spans all cells with data and returns a dictionary with its metrics. Accepts session or path — see the two modes.
Required parameters
Section titled “Required parameters”Ninguno — pero debes indicar session o path.
Optional parameters
Section titled “Optional parameters”| Parameter | Editor | Description |
|---|---|---|
session | expression | Excel Open session (instead of path). |
path | expression | Route to .xlsx (required if there is no session). |
sheet | expression | Name or 1-based index of the sheet. By default, the first. |
Output
Section titled “Output”Returns a Dictionary with these keys:
| Key | Description |
|---|---|
address | Address of the range used, e.g. A1:F120 |
rows | Number of rows with data |
columns | Number of columns with data |
firstRow / lastRow | First and last row |
firstColumn / lastColumn | First and last column |
Example
Section titled “Example”Get Excel Used Range path = = asset("datos.xlsx") → output: dimLog message = = "La hoja tiene " + dim["rows"] + " filas y " + dim["columns"] + " columnas"Related activities
Section titled “Related activities”- Read Excel Sheet — read the area with data to a DataTable.
- Get Sheet Names — list the sheets in the workbook.