Main Content


Get sheet names from spreadsheet file

Since R2019b



sheets = sheetnames(filename) returns a string array of sheet names from the specified spreadsheet file.


collapse all

Get the name of all worksheets from the spreadsheet file airlinesmall_subset.xlsx.

sheets = sheetnames('airlinesmall_subset.xlsx')
sheets = 13x1 string

Input Arguments

collapse all

Name of the file to read, specified as a character vector or a string scalar.

Depending on the location of your file, filename can take one of these forms.



Current folder or folder on the MATLAB® path

Name of the file.

Example: 'myFile.xls'

Other local folder

Full or relative path to the file.

Example: 'C:\myFolder\myFile.xlsx'

Example: 'myDir\myFile.xlsx'

Remote Location

Full path to the file, specified as a uniform resource locator (URL) of the form:


Based on the remote location, scheme_name can be one of the values in this table.

Remote Locationscheme_name
Amazon S3™s3
Windows Azure® Blob Storagewasb, wasbs

For more information, see Work with Remote Data.

Example: 's3://bucketname/path_to_file/my_file.xlsx'

  • On Windows® systems with Microsoft® Excel® software, the sheetnames function supports: .xls, .xlsm, .xlsx, .xltm, .xltx, .xlsb, and .ods.

  • If your system does not have Excel for Windows, then sheetnames supports only: .xls, .xlsx, .xlsm, .xltx, and .xltm files.

Data Types: char | string

Version History

Introduced in R2019b