%% Read Cell Array from Specified Sheet and Range
% Preview the data from a spreadsheet file and import the mixed data into a cell array from a specified sheet and range.
% The spreadsheet file airlinesmall_subset.xlsx contains data in multiple worksheets for years between 1996 and 2008.  Each worksheet has data for a given year. Preview the data from file airlinesmall_subset.xlsx. The preview function shows data from the first worksheet by default.

opts = detectImportOptions('airlinesmall_subset.xlsx');
preview('airlinesmall_subset.xlsx',opts)

% Import ten rows of data for variables 7, 8, and 9 from the worksheet named '2007'. The Excel range 'G2:I11' represents columns 7 through 9, and ten rows starting at row 2 after the variable names.

M = readcell('airlinesmall_subset.xlsx','Sheet','2007','Range','G2:I11')

% Copyright 2018 The MathWorks, Inc.