Xlsreadr

From Eigenvector Research Documentation Wiki
Jump to navigation Jump to search

Purpose

Reads .XLS files from MS Excel and other spreadsheets.

Synopsis

out = xlsreadr(file,sheets,options)

Description

This function reads Microsoft XLS files, parses the contents into a DataSet object. If called with no input a dialog box allows the user to select a file to read from the hard disk. Optional input (file) is a text string with the file name. Optional input (sheets) is a cell array containing the names of one or more sheets in XLS file to read. Or it can be a string specifying a single sheet to read, or it can be an integer vector specifying which sheets to read. If sheets contains any invalid names or index values then those invalid names or indices are removed from the requested sheets. Note that the primary difference between this function and the Mathworks function xlsread is the parsing of labels and output of a dataset object.

Optional input (options) specifies the parsing options. For details on these options, see parsemixed.

Note that the primary difference between this function and the Mathworks function xlsread is the parsing of labels and output of a dataset object.

Note: Some Excel files with unusual row or column content, such as empty cells in upper left corner, may fail to import. In any case where an Excel file fails to import a good alternative is to save the Excel file as type CSV, comma delimited (*.csv), then import this file into PLS_Toolbox/Solo.

Optional Inputs

  • file = Text string with name of excel file to read.
  • sheets = Integer or integer vector specifying which sheets to read text string specifying which sheet to read cell array of text strings specifying which sheets to read.
  • options = Structure array with the following fields, see PARSEMIXED.

Note in particular the PARSEMIXED options are used:

  • maxpreviewcols : [48] Number of columns to show in visual mode.
  • maxpreviewrows : [50] Number of rows to show in visual mode.

This means the default Excel importer Graphical Import Tool will only show up to 50 rows and 48 columns by default.

Outputs

  • out = Output dataset object containing contents of file.
  • usedoptions = options structure actually used when parsing (includes any options modified by the user in the graphical selection interface). Can be used to repeat an import with the same user-selected file parsing.

See Also

areadr, dataset, parsemixed, textreadr, writecsv, xclgetdata, xclreadr