Quantcast
Channel: Excel Data Reader - Read Excel files in .NET
Viewing all 448 articles
Browse latest View live

New Post: Read Formula?

$
0
0
Thanks for the reply - it would be a handy feature to have.

In my case I can infer the formula by comparing the source and destination values to get the multiplier value (e.g. 125%).

Reviewed: 2.1.2.0 (May 12, 2014)

$
0
0
Rated 5 Stars (out of 5) - Easy to use, simple. Thank you

Reviewed: 2.1.2.0 (May 19, 2014)

$
0
0
Rated 5 Stars (out of 5) - Yes i like that

New Post: Request for a "Proper" namespace.

$
0
0
Even though it might be something really trivial, I would suggest to change the namespace of this library to follow the guidelines mentioned in the Names of Namespaces page. It doesn't change the quality of the product, and yet it just looks better! :-)

New Post: Request for a "Proper" namespace.

$
0
0
It's a good idea, but would be a breaking change.

What namespace do you suggest?

New Post: Request for a "Proper" namespace.

$
0
0
The name of the dll, excel.dll, has also caused problem for us. We have had to rebuild the Excel Data Reader under a new name (ExcelDataReader.dll) in order to avoid conflicts with another excel.dll from another third-party provider.

I think that ExcelDataReader would be a good name for both the namespace and the dll.

New Post: Request for a "Proper" namespace.

$
0
0
I see in your profile that you're CTO of Release Mobile. If you developed that working there, you could use that as a Prefix. In my case, most projects I ever do are not linked to my employer so I use the name of a fake company I one day want to register. So in your case, for this product, I would go with
[YourFictiveCompanyName].ExcelDataReader (under which there would be .core, .Exceptions and .Log)

Yes, it is indeed a breaking change, but you could suggest people to :
  • If they had a using statement replace any "using Excel;" with "using Excel = YourFictiveCompanyName.ExcelDataReader;"
  • If they did't have a using statement (and used Excel.[One of your classes]) to add "using Excel = YourFictiveCompanyName.ExcelDataReader;"
However, with all that said, wether or not you do it is not a big deal, it doesn't change the fact that I like your library :-P

New Post: Request for a "Proper" namespace.

$
0
0
DanielRousseau wrote:
I think that ExcelDataReader would be a good name for both the namespace and the dll.
The namespace should contain a prefix before the product itself. I found this library when I was about to develop something I would have called [MyEmployer].ExcelFileReader, but without the prefix, a clash might happen too easily, imo.

New Post: Request for a "Proper" namespace.

$
0
0
That all makes sense.
It wouldn't be right to use my company name because I didn't create the library, just taken over supporting it. I guess something like ExcelTools.ExcelDataReader would do.

New Post: Can't open an excel file of type "Excel 2 Worksheets"

$
0
0
Hi there,

I'm trying to open a file that Excel recognizes as type "Excel 2 Worksheets" but when I open it with ExcelReaderFactory.CreateBinaryReader(stream), the reader says the file is invalid.

Is it supported?

Regards,
Fabian

New Post: Can't open an excel file of type "Excel 2 Worksheets"

$
0
0
I think that format is not supported.

New Post: Can't open an excel file of type "Excel 2 Worksheets"

$
0
0
Yes, this is my conclusion too :-(

New Post: Pass in header row value?

$
0
0
Have you considered (or is it possible) to work with a header row passed into the method?

I need to work with templated workbooks where the various templates place the header row at anything from row 3 to row 10. I could build a method that deletes the rows above the header and saves a copy of the file but that would represent significant overhead with large files (some I deal with have thousands of rows). Worse, there are several generations of templates in use so the only way to find the header row for the various versions of the same workbook would be to search for the range value. Right now the user looks at the file and identifies the header row.

Thanks!

New Post: Reading excel sheet without saving

$
0
0
Thanks for this.

I tried this (i.e. copy to memory stream) and yes, it does work.

This is very helpful for using this on Azure since we don't want to save files to local storage.

Commented Unassigned: ExcelReaderFactory.CreateBinaryReader fails [12992]

$
0
0
Pretty simple; code is as follows:

FileInfo thisfinfo = Utilities.GetFileInFolderByIndex(1, wipboardreports_folderpath);
FileStream stream = File.Open(thisfinfo.FullName, FileMode.Open, FileAccess.Read);
IExcelDataReader excelReader = ExcelReaderFactory.CreateBinaryReader(stream);

Fails on line three.

Exception information:
OUTPUT:
"
...
...
A first chance exception of type 'System.ArgumentException' occurred in mscorlib.dll
An unhandled exception of type 'System.ArgumentException' occurred in mscorlib.dll
Additional information: An item with the same key has already been added.
"

CALL STACK:
"
Excel.4.5.dll!Excel.ExcelBinaryReader.readWorkBookGlobals() Line 244
Excel.4.5.dll!Excel.ExcelBinaryReader.Initialize(System.IO.Stream fileStream) Line 917
Excel.4.5.dll!Excel.ExcelReaderFactory.CreateBinaryReader(System.IO.Stream fileStream) Line 24
Project2.exe!MyTestSystem.Program.Main() Line 48 + 0x9 bytes

"


System information:
OS: Windows 7 64 bit
Compiler: Visual studio default?


Thanks to anyone for your help!
Comments: ** Comment from web user: vDeveloper **

This issue is not coming because of formats dictionary.

It is because of adding logs in LogManager.cs file.
To resolve this issue, put a condition whether key is already present or not at line no. 48 in LogManager.cs file.

if(!_dictionary.ContainsKey(objectName))
_dictionary.Add(objectName, result);

I was facing the same issue and it got resolved with this update.


New Post: Excel sheet to array

$
0
0
Hello,
I'm trying to read the excel sheet and save all of its data into the 2D array. The problem is, that enything I do I get the error: System.NullReferenceException. I did FOR loops, I used foreach DataRow etc. but I still fail. My latest try:
            FileStream stream = File.Open(ExcelSourceFile, FileMode.Open, FileAccess.Read);
            IExcelDataReader excelReader = Path.GetExtension(ExcelSourceFile).ToLower() == ".xls" ? ExcelReaderFactory.CreateBinaryReader(stream) :ExcelReaderFactory.CreateOpenXmlReader(stream);
            DataSet ds = new DataSet();
            ds = excelReader.AsDataSet();
            DataRowCollection drc = ds.Tables[0].Rows;


int j=0;
            for (int i = 0; i < rows; i++)
            {
                foreach (DataColumn column in ds.Tables[0].Columns)
                {
                    DataFromExcel[i, j] = ds.Tables[0].Rows[i][j];
                    j++;
                }
            }
There might be some stuff from my previous tries. I know it must be the easiest thing to do with this library but I can't find the correct method. Hope someone can find few minutes to write it down.

Best regards,
Mike.

Commented Unassigned: Multithreaded Read [12936]

$
0
0
There seems to be an issue in Excel/Log/LogManager.cs if you concurrently read from multiple different xlsx files.

I fixed the issue by moving the sync-lock to cover up ContainsKey-Check too

From

```
public static ILog Log(string objectName)
{
ILog result = null;

if (_dictionary.ContainsKey(objectName))
result = _dictionary[objectName];

if (result == null)
{
lock (_sync)
{
result = Excel.Log.Log.GetLoggerFor(objectName);
_dictionary.Add(objectName, result);
}
}

return result;
}
```

to

```
public static ILog Log(string objectName)
{
ILog result = null;

lock (_sync)
{
if (_dictionary.ContainsKey(objectName))
result = _dictionary[objectName];

if (result == null)
{
result = Excel.Log.Log.GetLoggerFor(objectName);
_dictionary.Add(objectName, result);
}
}

return result;
}
```
Comments: ** Comment from web user: tripolitov **

Hi. Do you have any progress on this issue, how can I help you to promote it to the code?

New Post: Excel sheet to array

$
0
0

You may be best off reading it use the idatareader interface rather than a dataset. It will be quicker anyway. Not sure why you are getting null reference exceptions off top of my head though.

From: MikeKrop

Hello,
I'm trying to read the excel sheet and save all of its data into the 2D array. The problem is, that enything I do I get the error:System.NullReferenceException. I did FOR loops, I used foreach DataRow etc. but I still fail. My latest try:
            FileStream stream = File.Open(ExcelSourceFile, FileMode.Open, FileAccess.Read);
            IExcelDataReader excelReader = Path.GetExtension(ExcelSourceFile).ToLower() == ".xls" ? ExcelReaderFactory.CreateBinaryReader(stream) :ExcelReaderFactory.CreateOpenXmlReader(stream);
            DataSet ds = new DataSet();
            ds = excelReader.AsDataSet();
            DataRowCollection drc = ds.Tables[0].Rows;


int j=0;
            for (int i = 0; i < rows; i++)
            {
                foreach (DataColumn column in ds.Tables[0].Columns)
                {
                    DataFromExcel[i, j] = ds.Tables[0].Rows[i][j];
                    j++;
                }
            }
There might be some stuff from my previous tries. I know it must be the easiest thing to do with this library but I can't find the correct method. Hope someone can find few minutes to write it down.

Best regards,
Mike.

Read the full discussion online.

To add a post to this discussion, reply to this email ([email removed])

To start a new discussion for this project, email [email removed]

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online atcodeplex.com

Commented Unassigned: Multithreaded Read [12936]

$
0
0
There seems to be an issue in Excel/Log/LogManager.cs if you concurrently read from multiple different xlsx files.

I fixed the issue by moving the sync-lock to cover up ContainsKey-Check too

From

```
public static ILog Log(string objectName)
{
ILog result = null;

if (_dictionary.ContainsKey(objectName))
result = _dictionary[objectName];

if (result == null)
{
lock (_sync)
{
result = Excel.Log.Log.GetLoggerFor(objectName);
_dictionary.Add(objectName, result);
}
}

return result;
}
```

to

```
public static ILog Log(string objectName)
{
ILog result = null;

lock (_sync)
{
if (_dictionary.ContainsKey(objectName))
result = _dictionary[objectName];

if (result == null)
{
result = Excel.Log.Log.GetLoggerFor(objectName);
_dictionary.Add(objectName, result);
}
}

return result;
}
```
Comments: ** Comment from web user: Ian1971 **

I am too busy with project work to spend any time on this at the moment.
What I really need to do is move the whole thing to github, then you could submit a pull request.
The only other way you could help is to get access to modify the code. To do that you'd have to email https://www.codeplex.com/site/users/view/ExcelDataReader . Unfortunately, although I am pretty much the only developer active on this project I do not have permissions to add users, and I have no idea who "ExcelDataReader" actually is...Another reason I want to move this to github.

New Post: Excel sheet to array

$
0
0
Thank you.
Unfortunately after spending few more hours with tries it looks like I'm not understanding the iDataReader feature - it looks easy but I'm failing everytime I try to run the "excelReader.Read()". Can anyone post the solution to my problem? I'm unable to do it by myself.

Regards,
Mike.
Viewing all 448 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>