Saving Excel file and update sheet name

2 次查看(过去 30 天)
I would like to save my data to excel file. I am going to utilize several sheets and I would like to also name them while creating the excel file. For example;
xlswrite(Data_Pathway,DATA_SET_2,'sheet2','A2') ; % Data_Pathway is location of the file with its name. % DATA_SET_2 is my data that I am saving % To sheet2 starting from A2, because 1 row has the header. I a solution below (<http://mathworks.com/matlabcentral/newsreader/view_thread/149966)but> that requires opening the excel file again and I would like to avoid that if possible.
Thanks
filename = 'C:\SomeExcelFile.xls'; % Open Excel Automation server Excel = actxserver('Excel.Application'); % Make Excel visible Excel.Visible=1; % Open Excel file Workbook = Excel.Workbooks.Open(filename); % Get the list of sheets in the workbook Sheets = Excel.ActiveWorkbook.Sheets; % Rename the first sheet Sheets.Item(1).Name = 'This is sheet 1';

回答(0 个)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by