Get sheet names from spreadsheet file
sheets = sheetnames(filename)
example
sheets = sheetnames(filename) returns a string array of sheet names from the specified spreadsheet file.
sheets
filename
collapse all
Get the name of all worksheets from the spreadsheet file airlinesmall_subset.xlsx.
airlinesmall_subset.xlsx
sheets = sheetnames('airlinesmall_subset.xlsx')
sheets = 13x1 string "1996" "1997" "1998" "1999" "2000" "2001" "2002" "2003" "2004" "2005" "2006" "2007" "2008"
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.
Location
Form
Name of the file.
Example: 'myFile.xls'
'myFile.xls'
Other local folder
Full or relative path to the file.
Example: 'C:\myFolder\myFile.xlsx'
'C:\myFolder\myFile.xlsx'
Example: 'myDir\myFile.xlsx'
'myDir\myFile.xlsx'
Remote Location
Full path to the file, specified as a uniform resource locator (URL) of the form:
scheme_name://path_to_file/my_file.ext
scheme_name
path_to_file
my_file.ext
Based on your remote location, scheme_name can be one of the values in this table.
s3
wasb
wasbs
hdfs
For more information, see Work with Remote Data.
Example: 's3://bucketname/path_to_file/my_file.xlsx'
'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.
sheetnames
.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.
.xls, .xlsx, .xlsm, .xltx, and .xltm
Data Types: char | string
char
string
readcell | readmatrix | readtable | readtimetable | readvars
readcell
readmatrix
readtable
readtimetable
readvars
You have a modified version of this example. Do you want to open this example with your edits?