0

Im trying to add data to the last row, and I googled and came up with code below but it does not work for me what is it that I'm doing wrong?

XLWorkbook wb = new XLWorkbook();
var ws = wb.Worksheets.Add(config.ReportName);
MapFilters(ws, excelReportSource.Filters);
ws.Cell(3, 1).InsertTable(dataTable);
long fullrow = ws.Rows().Count();
long lastRow = ws.Cells[fullrow, 1].get_End(ClosedXML.Excel.XlDirection.xlUp).Row;

The last row in my code I get syntax error on ws.Cells[fullrow, 1], am I missing a namespace?

1
  • try lastRow = ws.usedRange().rows().count() + 1 Commented Jan 26, 2019 at 0:09

1 Answer 1

1

ws.Cells[fullrow, 1] is the syntax for the EPPlus library, not ClosedXML. You're obviously mixing code meant for different libraries.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.