public static ExcelRange UsedRange(this ExcelWorksheet ws, bool doDeleteEndEmptyColumnsAndRows = false) { if (doDeleteEndEmptyColumnsAndRows) { ws.DeleteEndEmptyColumnsAndRows(); } return(ws.Cells[1, 1, ws.EndRow(), ws.EndColumn()]); }