actxserver move data in entire row few rows down

6 views (last 30 days)
I am trying to use actxserver to format header row in an excel spreadsheet.
Before I manipulate header row, I would like to shift information in the second row (data row) down few rows to make additional spaces of rows between the header row and the data row.
I am having trouble doing seemingly simple task.
What I currently have is this:
function reformatHeader(excel_filename)
% Connect to the Excel COM object and open excel_filename
excel = actxserver('Excel.Application');
excel_wb = excel.Workbooks.Open(excel_filename);
sheet = excel_wb.ActiveSheet();
% Get the size of the sheet; assumes rectangular and not ragged
nColumns = sheet.Range('A1').End('xlToRight').Column;
nRows = sheet.Range('A1').End('xlDown').Row;
% Number of rows to add
nRowsToAdd = 2;
% I want to move the second row down by nRowsToAdd here
Basically the content of nRows should be moved to nRows+nRowsToAdd
There seems to be surprising little about of resources.. Is there a proper documentation with all commands?
I am using this at the moment, which isn't sufficient to do such simple operation: https://www.mathworks.com/help/matlab/matlab_external/using-a-matlab-application-as-an-automation-client.html
Thank you in advance.

Answers (0)

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!