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.
Seleccione un país/idioma
Seleccione un país/idioma para obtener contenido traducido, si está disponible, y ver eventos y ofertas de productos y servicios locales. Según su ubicación geográfica, recomendamos que seleccione: .
También puede seleccionar uno de estos países/idiomas:
Cómo obtener el mejor rendimiento
Seleccione China (en idioma chino o inglés) para obtener el mejor rendimiento. Los sitios web de otros países no están optimizados para ser accedidos desde su ubicación geográfica.
América
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- 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)