Excel Reader

Jun 2, 2011 at 6:51 PM

It works perfectly fine when working on xls. When I tried reading xlsx file, I got this error below. It is a good file, 2007.


Could not load file or assembly 'ICSharpCode.SharpZipLib, Version=, Culture=neutral, PublicKeyToken=

1b03e6acf1164f73' or one of its dependencies. The system cannot find the file specified.


Dim stream As FileStream = File.Open(filePath, FileMode.Open, FileAccess.Read)

'1. Reading from a binary Excel file ('97-2003 format; *.xls)
'Dim excelReader As IExcelDataReader = ExcelReaderFactory.CreateBinaryReader(stream)
'2. Reading from a OpenXml Excel file (2007 format; *.xlsx)
Dim excelReader As IExcelDataReader = ExcelReaderFactory.CreateOpenXmlReader(stream) <<< error
'3. DataSet - The result of each spreadsheet will be created in the result.Tables
Dim result As DataSet = excelReader.AsDataSet()
'4. DataSet - Create column names from first row
excelReader.IsFirstRowAsColumnNames = True
Dim result As DataSet = excelReader.AsDataSet()

'5. Data Reader methods
While excelReader.Read()
End While

'6. Free resources (IExcelDataReader is IDisposable)
Sep 27, 2011 at 10:17 PM

Hey there.


the download distribution of this library includes a ICSharpCode.SharpZipLib.dll assembly.  simply reference this and re-run your solution.

Dec 18, 2012 at 6:27 PM
simonwilbert wrote:

Hey there.


the download distribution of this library includes a ICSharpCode.SharpZipLib.dll assembly.  simply reference this and re-run your solution.


Same problem and I am including the ICSharpCode.SharpZipLib.dll which is in the package and its version number is (which is what it should be from error message) but I still get the error message as written by above comment.

I tried using ExcelData Reader version 2.0 for reading .xlsx file. However, it works just fine for reading .xls files.

Can someone answer what is the issue here? codeforlife? simon wilbert?

Dec 19, 2012 at 9:15 AM

Did you reference ICSharpCode.SharpZipLib.dll from your project in VS?

Sep 23, 2014 at 3:53 AM
I'm having the same problem. Added reference to ICSharpCode.SharpZipLib.dll, but get the "Could not load file or assembly ..." message anyway.
Sep 23, 2014 at 10:05 AM
What platform are you using?

The nuget package should set up the references you need. Does some other project you are referencing also use SharpZipLib.

You might also try the new portable class library based version (not on nuget yet)

This does not have a dependency on SharpZipLib.

Please send all future questions to github as we have moved there now
Sep 23, 2014 at 6:05 PM

@Ian971 –

I am running 64-bit Windows 7 with Visual Studio 2010. No other project that I reference uses SharpZipLib.

I didn’t use any Nuget package. Just downloaded the zip file from Codeplex. It only consists of the two DLLs and a .pdb file.

I added a reference to the DLLs in my project, which happens to by a SSIS script task.

Sep 24, 2014 at 4:46 PM

Are you able to use nuget to add the reference? It will then resolve the zip lib dependency

Sep 24, 2014 at 5:04 PM
Edited Sep 24, 2014 at 5:12 PM
I took your suggestion and downloaded the portable version of the library. I just used Nuget to add the reference. (This is my first time using Nuget, but I think I got it right.) I was able to build my project, which is a script task in SSIS. I had added an object of type IExcelDataReader in the code.

When I run my SSIS package, it hangs upon reaching the script task. Killing the package run and opening the task in VSTA, I can see a warning icon next to the reference to “Excel” in Solution Explorer. I had initially seen a message that ExcelDataReader couldn’t find SharpZipLib. I navigated to “ExcelDataReader-f-portable\Silverlight\Binaries\SharpZipLib.dll”, which was among the unzipped files. I added a reference to that DLL the old-fashioned, non-Nuget way.

The package still hangs. Insection of the project's references still shows the yellow triangle with exclamation point next to the “Excel” reference in Solution Explorer.