You can control the excel file directly without importing it through ActiveX:
% Open the excel file (it remains invisible however)
excel = actxserver ('Excel.Application');
workbook = excel.Workbooks.Open('C:\Users\ok1011\Desktop\test.xlsx');
% Activate the sheet you need (optional if the sheet is the first)
workbook.Worksheets.Item(1).Activate;
% Delete A2, shifts upwards
workbook.ActiveSheet.Range('A2').Delete
% Now save/close/quit/delete
workbook.Save;
excel.Workbook.Close;
invoke(excel, 'Quit');
delete(excel)
Best Answer