Hi,
I want to work with excelqueryfactory to read data from excel and want to know how to work with this from scratch.
and what are the required assemblies to use this.
please suggest me.
Regards,
Balu Reddy k
How to work with ExcelQueryFactory (Linq)
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Kunal Naik163 reputationPosted Nov 2, 2011, 5:01 AM EDT
Below example code shows how to retrieve from Excel using ExcelQueryFactory,
var book = new ExcelQueryFactory("pathToExcelFile"); var australia = from x in book.Worksheet() where x["Country"] == "Aust" select new { Country = x["Country"], BookCode = x["Code"], BookName = x["Name"] }; Also refer Following links for adding assemblies and to know more about ExcelQueryFactory, Click HereBaluReddy Kovvur31 reputationPosted Nov 2, 2011, 5:07 AM EDT
var book = new ExcelQueryFactory("C:/Documents and Settings/Desktop/details.xlsx");var test = from x in book.Worksheet()where x["Location"] == "Delhi"
select new{ Id = x["Id"],
Name = x["Name"],
Location = x["Location"]
};
GridView1.DataSource = test.ToString();
GridView1.DataBind();
iam using the above code but the output is wrong .
please suggest more options.
Regards,
Balu