sheetnames
Query sheet names from datastore
Description
Examples
Create a datastore containing the file airlinesmall_subset.xlsx.
ssds = spreadsheetDatastore('airlinesmall_subset.xlsx')
ssds =
SpreadsheetDatastore with properties:
Files: {
' ...\matlab\toolbox\matlab\demos\airlinesmall_subset.xlsx'
}
AlternateFileSystemRoots: {}
Sheets: ''
Range: ''
ReadFailureRule: 'error'
MaxFailures: Inf
Sheet Format Properties:
NumHeaderLines: 0
ReadVariableNames: true
VariableNames: {'Year', 'Month', 'DayofMonth' ... and 26 more}
VariableTypes: {'double', 'double', 'double' ... and 26 more}
Properties that control the table returned by preview, read, readall:
SelectedVariableNames: {'Year', 'Month', 'DayofMonth' ... and 26 more}
SelectedVariableTypes: {'double', 'double', 'double' ... and 26 more}
ReadSize: 'file'
Query the sheet names of the first (and only) file in the datastore.
sheetnames(ssds,1)
ans =
13×1 string array
"1996"
"1997"
"1998"
"1999"
"2000"
"2001"
"2002"
"2003"
"2004"
"2005"
"2006"
"2007"
"2008"
Input Arguments
Input datastore, specified as a SpreadsheetDatastore
object. Use the spreadsheetDatastore function
or the datastore function to
create a datastore object from your data.
File in datastore, specified as a character vector or string scalar containing the name of the file to query.
The value of filename must match exactly the file name
contained in the Files property of the datastore. To
ensure that the file names match exactly, specify
filename using ssds.Files{N} where
N is the index of the file in the
Files property.
Example: names = sheetnames(ssds,ssds.Files{1}) returns
sheet names contained in the first file specified in the
Files property of the datastore
ssds.
Data Types: char | string
File index, specified as a positive integer. I cannot
exceed the number of files in ssds.
Data Types: double
Output Arguments
Sheet names, returned as a string array containing the sheet names in the specified file.
Data Types: string
Version History
Introduced in R2016a
See Also
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Sélectionner un site web
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.
Amériques
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)