DeadlyDagger
DeadlyDagger

Reputation: 129

Adding data to the last row not empty of excel sheet c#

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?

Upvotes: 0

Views: 558

Answers (1)

Francois Botha
Francois Botha

Reputation: 4839

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

Upvotes: 1

Related Questions