File Exchange

image thumbnail

Delete worksheets in Excel file

version (4.28 KB) by Guilherme Coco Beltramini
Delete selected worksheets or all empty worksheets in Excel file


Updated 03 Jun 2013

View Version History

View License

Delete worksheets in Excel file


- XLSFILE: name of the Excel file
- SHEETS: cell array with the worksheet names, or matrix with positive integers to tell which worksheets are going to be protected. If SHEETS=[], all empty sheets will be deleted.

- XLSFILE will be edited

Cite As

Guilherme Coco Beltramini (2021). Delete worksheets in Excel file (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (5)


Dankur Mcgoo


Dankur Mcgoo

Works great!
Just as FYI to anyone else w.r.t. my last comment, you need to FULL filepath.


Joseph McDonald

Perfect functionality for my requirements.
I am using to delete the default blank work sheets from a new workbook after my function has created it.

John Chow

Very useful. I use xlswrite with Worksheet Name as an input argument and always end up with 3 blank sheets at the beginning. This program delete all blank sheets.

MATLAB Release Compatibility
Created with R2010a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Inspired by: Check if XLS file is open and close it

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!