What is the expected output? What do you see instead?
i want just read file.
What version of the product are you using? On what operating system?
letest
Please provide any additional information below.
I m Import that file which is export from my server data in excel format
and that file i want to import using linqtoexcel without open that file
on my pc.
when that file i m open on my computer and save it then it complitely get data
from excel.
I dont know what is problem ,,,, may be excel is in read mode or not in
editable . please help me ...
mycode is --------
string path = "";
string extension = System.IO.Path.GetExtension(Request.Files["uploadfile"].FileName);
path = string.Format("{0}/{1}", Server.MapPath("~/Content/UploadedFolder"), Request.Files["uploadfile"].FileName);
if (System.IO.File.Exists(path))
System.IO.File.Delete(path);
Request.Files["uploadfile"].SaveAs(path);
var excel = new ExcelQueryFactory(path);
var col =excel.GetColumnNames(excel.GetWorksheetNames().First());
if (col.Contains("villageid") && col.Contains("farmerid"))
{
var list = from c in excel.Worksheet<ImportCollection>(excel.GetWorksheetNames().First()).ToList()
select new ImportCollection
{
villageid = c.villageid,
farmerid = c.farmerid.ToString(),
sampleno = c.sampleno.ToString(),
dtdate = c.dtdate.ToString(),
shift = c.shift.ToString(),
milktype = c.milktype.ToString(),
Qty = c.Qty.ToString(),
fat = c.fat.ToString(),
snf = c.snf.ToString(),
clr = c.clr.ToString(),
rtpl = c.rtpl.ToString(),
Amount = c.Amount.ToString()
};
Session.Add("List", list);
return Json(list, JsonRequestBehavior.AllowGet);
}
Original issue reported on code.google.com by patel33h...@gmail.com on 12 May 2014 at 5:41
Original issue reported on code.google.com by
patel33h...@gmail.com
on 12 May 2014 at 5:41