1

Im trying to use the Linq to Excel library, and i get stucked into this problem.

I have an excel with a worksheet name, and i need to define the range of the colums that i need to get.

The problem is: how to use these two classes at the same time on query?

excel.Worksheet<Company>("NAME OF WORKSHEET")

and

excel.WorksheetRange<Company>("B37", "M37")

Example:

 var print = from c in excel.WorksheetRange<Company>("B37", "M37")
             select c;

(but i cant do this, because i need to set the worksheet name first)

Thanks!

svick
  • 236,525
  • 50
  • 385
  • 514
Otuyh
  • 2,384
  • 5
  • 22
  • 40

1 Answers1

3

You can pass the worksheet name as the 3rd argument in the WorksheetRange<>() method.

var print = from c in excel.WorksheetRange<Company>("B37", "M37", "NAME OF WORKSHEET")
            select c;
Paul
  • 18,349
  • 7
  • 49
  • 56