linq-to-excel

Referencing columns in LinqToExcel using ordinal position

二次信任 提交于 2019-12-09 16:41:02
问题 I am in the unusual position of having two different templates for an Excel upload, one that is 'human friendly' and one that is machine generated. As such, the column data headers are different and it is difficult to align them. As such, I would like to reference the column mappings using the ordinal position rather than the 'name' of the column. Currently I have this: var excel = new ExcelQueryFactory(excelFileName); excel.AddMapping<Student>(x => x.FirstName, "First Name"); excel

LinqToExcel: Distinct values in excel column

◇◆丶佛笑我妖孽 提交于 2019-12-08 20:49:35
This might be a very simple thing for you gurus, but I'm not familiar with C#4 and INTEROP. Therefore, I'm stumped. Here's my problem. I have a excel column that has duplicate data and I want to trim it down to only unique values. Here's what the data looks like: ColA ColB 10 Adam 12 Jane 14 Adam 18 Adam 20 Eve So, in the end I just want unique names from ColB: Adam Jane Eve I know that I can do this by getting all those values into a List and then adding the Distinct functionality to it. But I think I'm doing something wrong. Anyway, here's my program: Application XLApp = new Microsoft.Office

Get all the values from excel file by using linqtoexcel

懵懂的女人 提交于 2019-12-08 05:27:21
问题 I'm using linqtoexcel in my asp.net mvc 4 project to read an excel file & get all the values from there. But I'm only getting the values of last row. Here are my codes, Controller public ActionResult ExcelRead() { string pathToExcelFile = "" + @"C:\MyFolder\ProjectFolder\sample.xlsx"; string sheetName = "Sheet1"; var excelFile = new ExcelQueryFactory(pathToExcelFile); var getData = from a in excelFile.Worksheet(sheetName) select a; foreach (var a in getData) { string getInfo = "Name: "+ a[

LinqToExcel on Windows7 64 bit with office 64bit

雨燕双飞 提交于 2019-12-06 08:33:44
问题 I have created windows forms application using linqtoexcel to read excel files it runs fine on windows 7 32/64 bit with office 32 bit but on windows 64 bit with office 64 it throws 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine Can anyone help me how I can run my application on 64bit office 回答1: You need to install Access Database Engine. More details Office Microsoft Access Database Engine 2010 Redistributable If your project use x86 LinqToXml install x86

LinqToExcel on Windows7 64 bit with office 64bit

核能气质少年 提交于 2019-12-04 12:34:10
I have created windows forms application using linqtoexcel to read excel files it runs fine on windows 7 32/64 bit with office 32 bit but on windows 64 bit with office 64 it throws 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine Can anyone help me how I can run my application on 64bit office You need to install Access Database Engine. More details Office Microsoft Access Database Engine 2010 Redistributable If your project use x86 LinqToXml install x86 otherwise x64 version of Access Database Engine. For x64 Windows and x64 Office can be used also x86 LinqToXml and

LinqToExcel GetColumnNames at specific Row

本小妞迷上赌 提交于 2019-11-30 16:58:49
问题 I am using the library LinqToExcel to read excel files in my mvc4 project. My problem is when I try to read the headers at row 4... How I can do this? In project, exists a function that returns all the column names, but I suppose that the columns need to be at row 0. // Summary: // Returns a list of columns names that a worksheet contains // // Parameters: // worksheetName: // Worksheet name to get the list of column names from public IEnumerable<string> GetColumnNames(string worksheetName);

LinqToExcel to load Dictionary

梦想与她 提交于 2019-11-28 10:19:49
问题 I have the following worked out but quite less than elegant. I'd like to work this out with ToDictionary if possible. Thank you for any help as I'm pretty new. var excel = new ExcelQueryFactory(@"E:\MAHipotCepaStationProgram.xlsx"); //get list of program names List<string> testNames = new List<string>(); testNames.AddRange(excel.Worksheet().ToList() .Where(s => s["Program #"].Value.ToString() == "Program Title") .Select(s => s[1].Value.ToString())); //get list of program numbers List<int>