XL.Sheet.CellType
-----------------

Queries type of cell.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [XL](component_XL.md) | [3.5](newinversion35.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "XL.Sheet.CellType"; BookRef; SheetIndex; Row; Column ) 

**MBS**( **"XL.Sheet.CellType";** /\* Queries type of cell. \*/  
**$BookRef**; /\* The reference number for the workbook.e.g. $ref \*/   
**$SheetIndex**; /\* The index of the sheet. This number ranges from 0 to [XL.Book.SheetCount](XLBookSheetCount.md)-1.e.g. 0 \*/   
**$Row**; /\* The row for the cell. First row has index 0. \*/   
**$Column**) /\* The column for the cell. First column has index 0. \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| BookRef | The reference number for the workbook. | $ref |
| SheetIndex | The index of the sheet. This number ranges from 0 to [XL.Book.SheetCount](XLBookSheetCount.md)-1. | 0 |
| Row | The row for the cell. First row has index 0. | $row |
| Column | The column for the cell. First column has index 0. | $column |

### Result

Returns type or error message.

### Description

Queries type of cell.  
Types can be empty, number, text, boolean, blank or error.  
### Examples

Try the function:

 # Initialize the [XL](component_XL.md) functions if not already initialized   
If \[MBS ("[XL.IsInitialized](XLIsInitialized.md)") ≠ 1\]  
 Set Variable \[$libPath ; Value: "/Library/FileMaker Server/libxl.dylib"\]  
 Set Variable \[$initResult ; Value: MBS ("[XL.Initialize](XLInitialize.md)"; $libPath )\]  
End If  
  
\# Create a new Excel workbook   
Set Variable \[$book ; Value: MBS ("[XL.NewBook](XLNewBook.md)"; 0)\]  
  
\# Add a sheet named "TestSheet"   
Set Variable \[$sheet ; Value: MBS ("[XL.Book.AddSheet](XLBookAddSheet.md)"; $book ; "TestSheet")\]  
  
\# Write a number to cell A1   
Set Variable \[$r ; Value: MBS ("[XL.Sheet.CellWriteNumber](XLSheetCellWriteNumber.md)"; $book ; $sheet ; 0; 0; 123)\]  
  
\# Write a text to cell B1   
Set Variable \[$r ; Value: MBS ("[XL.Sheet.CellWriteText](XLSheetCellWriteText.md)"; $book ; $sheet ; 0; 1; "Hello World")\]  
  
\# Write a boolean to cell C1   
Set Variable \[$r ; Value: MBS ("[XL.Sheet.CellWriteBoolean](XLSheetCellWriteBoolean.md)"; $book ; $sheet ; 0; 2; True)\]  
  
\# Write a formula to cell D1   
Set Variable \[$r ; Value: MBS ("[XL.Sheet.CellWriteFormula](XLSheetCellWriteFormula.md)"; $book ; $sheet ; 0; 3; "=SUM(A1)")\]  
  
\# Query the type of each cell   
Set Variable \[$typeA1 ; Value: MBS ("XL.Sheet.CellType"; $book ; $sheet ; 0; 0)\]  
Set Variable \[$typeB1 ; Value: MBS ("XL.Sheet.CellType"; $book ; $sheet ; 0; 1)\]  
Set Variable \[$typeC1 ; Value: MBS ("XL.Sheet.CellType"; $book ; $sheet ; 0; 2)\]  
Set Variable \[$typeD1 ; Value: MBS ("XL.Sheet.CellType"; $book ; $sheet ; 0; 3)\]  
  
\# Display the results   
Show Custom Dialog \["Cell Types"; "A1: " &amp; $typeA1 &amp; "¶B1: " &amp; $typeB1 &amp; "¶C1: " &amp; $typeC1 &amp; "¶D1: " &amp; $typeD1 \]  
  
\# Save the workbook to a container field   
Set Field \[YourTable::ExcelFile ; MBS ("[XL.Book.Save](XLBookSave.md)"; $book ; "TestWorkbook.xls")\]  
  
\# Release the workbook to free memory   
Set Variable \[$r ; Value: MBS ("[XL.Book.Release](XLBookRelease.md)"; $book )\]  
### See also

- [XL.Book.AddSheet](XLBookAddSheet.md)
- [XL.Book.Release](XLBookRelease.md)
- [XL.Book.Save](XLBookSave.md)
- [XL.Initialize](XLInitialize.md)
- [XL.IsInitialized](XLIsInitialized.md)
- [XL.Sheet.CellIsDate](XLSheetCellIsDate.md)
- [XL.Sheet.CellWriteBoolean](XLSheetCellWriteBoolean.md)
- [XL.Sheet.CellWriteFormula](XLSheetCellWriteFormula.md)
- [XL.Sheet.CellWriteNumber](XLSheetCellWriteNumber.md)
- [XL.Sheet.CellWriteText](XLSheetCellWriteText.md)

This function checks for a license.

Created 18th August 2014 , last changed 12nd June 2025

  
[XL.Sheet.CellReadValues](XLSheetCellReadValues.md) - [XL.Sheet.CellWriteBlank](XLSheetCellWriteBlank.md)

[HTML Version](XLSheetCellType.shtml)