score:2

Accepted answer

With respect to the code that has commented when setting a new value to excelDataRows it is resetting the value of the list, what you have to use is the Add method that has the list.

Here I leave you an example of how you should do it based on the code that you have commented.

excelDataRows.Add(new ExcelDataTableRow
    {
        CellValues = new List<string>
        {
            "HOLA",
            "CHAU"
        }
    }
); 

return excelDataRows;

Related Articles