Hi Sara,
please refer to the following Matlab Answers Post which addresses the similar issue:
- https://www.mathworks.com/matlabcentral/answers/411253-how-can-i-write-data-into-excel-sheet-and-hide-other-unused-rows-and-columns-in-a-sheet
- https://www.mathworks.com/matlabcentral/answers/665753-how-to-hide-rows-in-an-excel-sheet-through-matlab-by-text-name?s_tid=answers_rc1-2_p2_MLT
I hope it helps!