xlsfinfo

Provides information about Excel compatibility with the file, file, using omlxlstoolbox.

Syntax

type = xlsfinfo(file)

[type, sheets] = xlsfinfo(file)

[type, sheets, format] = xlsfinfo(file)

[type, sheets, format, namedranges] = xlsfinfo(file)

Inputs

file
Name of the file to to check for Microsoft Excel compatibility.
Type: string

Outputs

type
If the file is readable in Microsoft Excel, type will be 'Microsoft Excel Spreadsheet'. If not readable, an empty string will be returned. If no output or no other outputs are specified, information about an Excel compatible file, file, will be displayed in the OML command window.
Type: string
sheets (optional)
Returns a cell array of nX2, where n is the number of sheets in file. The first column of sheets contains the name of the sheet. The second column of sheets contains the used data range from left to right. If this output is not specified, this information is printed in the OML command window.
Type: cell
format (optional)
Output which returns the type of the Excel compatible file. If it is not compatible, an empty string will be returned.
Type: string
namedRanges (optional)
Returns information about named ranges, if any. namedRanges will be a cell array with three columns. The first column contains the name of range. The second column contains the parent sheet name where the named range is applicable. If applicable to the entire workbook, this field will contain the filename, file. The third column contains the range of this named range entry.
Type: cell

Examples

Get information about an Excel file with sheet names printed to the OML command window:
xlsfinfo('test.xls')
1: Sheet1    (Used range ~ B1:D3)
2: Sheet2    (Used range ~ A1:C4)
ans = Microsoft Excel Spreadsheet
Get information about an Excel file with the file format:
[filetype, sheets, format] = xlsfinfo('large2.xlsx')
filetype = Microsoft Excel Spreadsheet
sheets =
{
  [1,1] Sheet1 name
  [1,2] A1:A1
  [2,1] Sheet2 new name
  [2,2] A1:B3
  [3,1] 3rd Sheet name
  [3,2] A1:D32
  [4,1] Info
  [4,2] A1:D4
  [5,1] sheet5_name
  [5,2] A1:C1
}
format = xlOpenXMLWorkbook
Get information about a file that is not readable in Microsoft Excel:
xlsfinfo('Untitled1.oml')
1:Untitled1.oml	(UsedRange ~ A1:A2)
ans = 
Get information about a Microsoft Excel spreadsheet with named ranges:
[type, sheets, fmt, range] = xlsfinfo('large1.xlsx')
type = Microsoft Excel Spreadsheet
sheets =
{
  [1,1] ABC123
  [1,2] B2:AZ8448
}
fmt = xlOpenXMLWorkbook
ranges =
{
  [1,1] namedrange1
  [1,2] ABC123
  [1,3] E10
  [2,1] test
  [2,2] large1.xlsx
  [2,3] B7:E14
}