How can you copy a row in ClosedXML?
var sheet = oldFile.Worksheet(1);
IXLRow headerRow = sheet.Row(1);
var newFile = new XLWorkbook();
var ws = newFile.Worksheets.Add("Sheet to copy to");
// how to copy header row to ws?
// this doesn't work
// ws.Cell(1, 1).InsertData(headerRow);
Additionally, say I had a collection of rows from the oldFile
.
var rowsIWantToCopy = someColumn.CellsUsed()
.Where(c => c.Value.ToString() == "someValue")
.Select(c => c.WorksheetRow())
.ToList();
// copy rows to a new worksheet
I have tried utilizing the ranges of the columns too. That doesn't seem to work because they are the incorrect range for the new file.