%% Write Table to Specific Sheet and Range in Spreadsheet
% Create a table.

T = table(['M';'F';'M'],[45 45;41 32;40 34],...
    {'NY';'CA';'MA'},[true;false;false])

%
% Write the table to a spreadsheet named myData.xls. Include the data on the first sheet in the 5-by-5 region with corners at B2 and F6. You can change the worksheet to write to by specifying the index corresponding to the worksheet.

writetable(T,'myData.xls','Sheet',1,'Range','B2:F6')

% Excel® fills the row of the spreadsheet from B6 to F6 with #N/A since the range specified is larger than the size of the input table T.
% Copyright 2012 The MathWorks, Inc.