Read Excel sheet into a structure array

Version 1.0 (7.59 KB) by Wei-Rong Chen
Read Excel sheet into a structure array
822 Downloads
Updated 11 Apr 2015

View License

% outstruct=xls2struct(xlsFName,sheetnum)
% This function reads the sheet of 'sheetnum' of the input Excel file('xlsFName') and convert it into a
% 1x1 structure array 'outstruct' containing column fields.
% Each field in the output structure containes the data of the
% corresponding column in the input Excel sheet.
% The input Excel sheet MUST content a header row as the first row, which
% will serve as the field name of the output struct.
% 'sheetnum' : the number of the sheet in the input Excel file from which
% the data are read. Default = 1
% Example:
% xls2struct('text.xlsx');
%
% See also 'WriteXlsFromStruct.m'

Cite As

Wei-Rong Chen (2026). Read Excel sheet into a structure array (https://www.mathworks.com/matlabcentral/fileexchange/50464-read-excel-sheet-into-a-structure-array), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2008a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags
Version Published Release Notes
1.0