OpenXML add new row to existing Excel file [closed]
I've got lots of XLSX files and I need to append a new row after the last one in the file. I'm using OpenXML and so far I know how to open/create spreadsheet, but my search for adding new rows to existing files returned nothing. Any ideas ? If all you need to do is add a blank row to the end and you don't care if a row already exists at the row index, then the following should work for you: public static void InsertRow(WorksheetPart worksheetPart) { SheetData sheetData = worksheetPart.Worksheet.GetFirstChild<SheetData>(); Row lastRow = sheetData.Elements<Row>().LastOrDefault(); if (lastRow !=