1

I'm using LinqToExcel to get some data from an excel file and it works just fine for the common tasks, but there is a problem when a column extends to many rows.

This is the common task, get a data row.

This is the common task, get a row data

But when a column from the same record extends to several rows, i just can't get a single data row that includes all those rows, instead i get several rows with null data from the 'from' and 'to' columns.

enter image description here

This is the code that i'm using currently:

var book = new ExcelQueryFactory(pathFile);
var result = (from row in book.Worksheet("Sheet1")
            let item = new packages
            {
                from = row["From"].Cast<string>(),
                to = row["to"].Cast<string>(),

                items = new List<packages.items>()
                {
                    new items()
                    {
                        items = row["items"].Cast<string>()
                    }
                }
            }
            select item).ToList();

So my question is, how can i get a single row that includes, taking in consideration the above example, the string from the "to" and "from" columns, and a list from the "items" column and so on from my hole table?

0 Answers0