Alternative to LinqToexcel: implementation of LinqToExcel Adapter

Oct 14, 2016 at 2:54 PM
This is a Wrapper classes around ExcelDataReader to make it work like LinqToExcel.

Base on first on source code : http://codereview.stackexchange.com/questions/47227/reading-data-from-excel-sheet-with-exceldatareader
Linq implementation based on : https://msdn.microsoft.com/en-us/library/bb546158.aspx

Problem:
When you compile your software in 64 bits and use LinqToExcel with Office installed in 32 bits mode, you cannot use LinqToExcel.
When you compile your software in 32 bits and use LinqToExcel with Office installed in 64 bits mode, you cannot use LinqToExcel.

Why ? because it use a driver (installed with Office) that must be in the same target a your software.
Of course, installing 32 and 64 bits drivers is not easy (there are some workaroud) and not always possible (in compagny for example), or
for public users.

Idea ? Rewrite all code that use LinqToExcel in my software or used another excel reader and make an adapter to work exactly like LinqToExcel.
It is this second option that I have tried to make.
Of course, for the moment, all LinqToExcel interface is not implemented but 3 functions :
  • WorksheetRangeNoHeader
  • WorksheetRange
  • GetColumnNames
You can use Linq to query into excel, make mapping to automatically fill class on each row.
Mapping with column's name is not always the first row, it can be anywhere.

Probably it is a good start to make your library more efficient and simple to use.
Sur it's missing code to complete linq work.

Stéphane Château (Feneck91)

You can download it : ExcelDataReaderLinqToExcelAdapter.zip
Oct 14, 2016 at 4:06 PM
Edited Nov 22, 2016 at 2:53 PM
There is a bug into it. You cannot use a Where clause.

This is corrected version of LinqToExcelAdapter: ExcelDataReaderLinqToExcelAdapter.zip
Nov 22, 2016 at 2:54 PM
Edited Nov 22, 2016 at 2:55 PM
Create a Version 2 :
  • Add Function : Worksheet
  • Throw exception if Worksheet not found.
This is version 2 of LinqToExcelAdapter: ExcelDataReaderLinqToExcelAdapter_v_2.zip