XL.Book.DeleteSheetsExcept
--------------------------

Deletes all sheets except the one with given name.

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

MBS( "XL.Book.DeleteSheetsExcept"; BookRef; Name ) 

**MBS**( **"XL.Book.DeleteSheetsExcept";** /\* Deletes all sheets except the one with given name. \*/  
**$BookRef**; /\* The reference number for the workbook.e.g. $ref \*/   
**$Name**) /\* The name of the sheet to keep.e.g. "People" \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| BookRef | The reference number for the workbook. | $ref |
| Name | The name of the sheet to keep. | "People" |

### Result

Returns OK or error.

### Description

Deletes all sheets except the one with given name.  
Returns error if sheet name is not found.  
On success, the book has only one sheet left.  
If the sheet to delete is referenced by other sheets, this may cause problems.  
### Examples

Delete all sheets except one:

 Set Variable \[$r ; Value:MBS ("XL.Book.DeleteSheetsExcept"; $bookRef ; "Reiter 2")\]  
### See also

- [XL.Book.DeleteSheet](XLBookDeleteSheet.md)

### Blog Entries

- [LibXL for FileMaker with extras](https://www.mbsplugins.de/archive/2021-03-02/LibXL_for_FileMaker_with_extra/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 5.4pr5](https://www.mbsplugins.de/archive/2015-11-10/MBS_FileMaker_Plugin_version_5/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 4th November 2015 , last changed 4th November 2015

  
[XL.Book.DeleteSheet](XLBookDeleteSheet.md) - [XL.Book.ErrorCode](XLBookErrorCode.md)

[HTML Version](XLBookDeleteSheetsExcept.shtml)