MATLAB: How to insert new column to existing excel sheet

activexexcel

My aim is to insert new column/Cells (for specific range e.g B2:B8 ) with out interrupting other cells or data.More specific i want to insert New cells without disturbing remaining pattern and data. If it is possible using actxserver kindly share your experience with me thanks.

Best Answer

Not tested:
excel = actxsever('Excel.Application');
wb = excel.Workbooks.Open('somefile.xlsx');
ws = wb.Worksheets.Item('sheetname');
ws.Range('B2:B8').Insert;
%other code
wb.Save;
excel.Quit;
delete(excel);
edited for numerous errors!