I am creating an Excel using the Matlab xlswrite function. How can I change the name of the first sheet of this Excel document? (I have read the official matlab help, but I haven´t found any solution).
You can use ActiveX directly from MATLAB:
xlswrite('test.xls',1) % # create test file
e = actxserver('Excel.Application'); % # open Activex server
ewb = e.Workbooks.Open('c:\test\test.xls'); % # open file (enter full path!)
ewb.Worksheets.Item(1).Name = 'new name'; % # rename 1st sheet
ewb.Save % # save to the same file
ewb.Close(false)
e.Quit
Be careful while testing, it overwrite the original file. Make a backup.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With