Name
xlsx.GetCellValue -- get cell value
Synopsis
v, t = xlsx.GetCellValue(id, x, y[, sheet])
v, t = xlsx.GetCellValue(id, ref[, sheet])
Function
This function returns the value of a certain cell. There are two ways of specifying the cell whose value should be returned: You can either specify the cell to use by passing the cell's column (x) and row (y) position in the x and y arguments. Those positions start from 1 for the first column and row. Alternatively, you can also specify the cell by passing its reference in the ref parameter. This can either be a string, e.g. "A10" for the first cell in the 10th row, or an iterator state returned by the xlsx.CellRange() function. Optionally, you can also pass the index of the worksheet to use in the optional sheet parameter (starting from 1 for the first worksheet). If the sheet parameter is omitted, the worksheet set by xlsx.SetDefaultSheet() will be used.

xlsx.GetCellValue() returns two values: The actual cell value in the first return value and the cell value type in the second return value. The return value type will be one of the following special constants:

#INTEGER
An integer number.

#DOUBLE
A floating point value.

#STRING
A string value.

#BOOLEAN
A boolean value (either True or False).

#NIL
The cell is empty.

#VOID
Indicates an invalid value, e.g. NaN or a logical error like division by zero.

Note that when trying to get the values of many cells it's usually much faster to use the xlsx.CellRange() function together with a generic for loop to iterate over the desired cells. This is especially recommended when dealing with large XLSX documents that have thousands of cells.

Inputs
id
identifier of the XLSX document to use
x
column index of the cell to use (starting from 1)
y
row index of the cell to use (starting from 1)
ref
cell reference (e.g. "A1" or an iterator state), only used when x and y are omitted
sheet
optional: index of the worksheet to use (defaults to the index of the default worksheet)
Results
v
cell value
t
type of the cell value (see above for possible types)
Example
xlsx.Open(1, "test.xlsx")
cols = xlsx.GetColumnCount(1)
rows = xlsx.GetRowCount(1)
For Local y = 1 To rows
   For Local x = 1 to cols
      DebugPrint((xlsx.GetCellValue(1, x, y)))
   Next
   DebugPrint("************************")
Next
xlsx.Close(1)
The code above opens test.xlsx and prints the values of all cells.

Show TOC