new row in a excel file
17 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello, does somebody know how to insert a new row in a excel already made? I need to insert in that row the results from another function. Thank you
1 Kommentar
Johannes Hougaard
am 4 Jan. 2023
Hi Carmo
If you want to add a new row to the bottom of your excel sheet you can use the function writematrix with the write mode 'append'
new_line = randn(1,9);
writematrix(new_line,'thisisanexcelfile.xlsx','Sheet',sheetno,'WriteMode','append');
Antworten (1)
Cameron
am 4 Jan. 2023
Bearbeitet: Cameron
am 4 Jan. 2023
Excel = actxserver('Excel.Application');
set(Excel, 'Visible', 1);
Workbooks = Excel.Workbooks;
Workbook = invoke(Workbooks, 'Add');
Excel.ActiveWorkbook.ActiveSheet.Range("C3").Value = "Row 3"; %on row 3
Excel.ActiveWorkbook.ActiveSheet.Range("C4").Value = "Row 4"; %on row 4
Excel.ActiveWorkbook.ActiveSheet.Range("C4").EntireRow.Insert; %now the text "Row 4" is on C5
0 Kommentare
Siehe auch
Kategorien
Mehr zu Spreadsheets finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!