New Post: want to check excel sheet contains formula or not? IS it possible in Excel Data reader?
Created Unassigned: I want to check excel sheet contains formula and Filter in any cell? IS it possible in Excel Data reader? [13626]
New Post: Microsoft Excel 97-2003 Worksheet (.xls) bad signature override?
Well i had the same issue and i think i figured out a solution.
1- Open the file in microsoft excel
2- File > Export > Change File Type
3- I picked Excel 92-2003 Workbook (*.xls)
then used the new exported file instead of the old one
this worked for me, and hope to be helpful for you
Commented Unassigned: Example of excel file returning no datasets - OpenXmlReader [12455]
excelReader = Excel.ExcelReaderFactory.CreateOpenXmlReader(stream);
DataSet result = excelReader.AsDataSet();
result is null for the attached file.
Comments: ** Comment from web user: bhavi **
I have same problem. can anyone have found solution ?
Commented Unassigned: Can't reference column by name? (non-DataTable) [13568]
while (excelReader.Read())
{
var branch = excelReader["Branch"].ToString(); // <-- I get a __NotSupportedException__
Also, it seems the "IsFirstRowAsColumnNames" property is ignored if you're enumerating the reader? I checked a value by index and it was the header row.
Comments: ** Comment from web user: jonkey86 **
I have a similar issue in which if my column header has a trailing space, the ExcelDataReader will not be able to parse the column
I can usually do this, row["ColumnName"] but if when it has a trailing space, I can't event do this row["ColumnName "] as I get the same exception.
My only choice is to either remove the trailing space from the spreadsheet, or reference the column by index.
Anyone experience something similar?
Created Unassigned: Can't read columns when header row has a trailing space [13671]
I can usually do this, row["ColumnName"] but if when it has a trailing space, I can't event do this row["ColumnName "] as I get the "NotSupportedException".
My only choice is to either remove the trailing space from the spreadsheet, or reference the column by index. I have also tried looping thru the columns to get their names and then try to access the data using these names, but I get the same exception.
Anyone experience something similar or have a workaround other than changing the spreadsheet?
Created Unassigned: Numeric strings are converted to numbers [13688]
like 0100 becomes 100.0
If I use ' to force a string it works.
I would be greatful for a quick update.
Commented Unassigned: Numeric strings are converted to numbers [13688]
like 0100 becomes 100.0
If I use ' to force a string it works.
I would be greatful for a quick update.
Comments: ** Comment from web user: RamakantVerma **
I also have the same issue
Commented Unassigned: Numeric strings are converted to numbers [13688]
like 0100 becomes 100.0
If I use ' to force a string it works.
I would be greatful for a quick update.
Comments: ** Comment from web user: RamakantVerma **
In Excel Sheet i Change the Cell Data Type to Number with 0 Decimal Place, Then also it mapping all integer to the Double Data type
Created Unassigned: excel data reader does not allow to read excel file simultaneously [13692]
I am using excel data reader for reading excel files simultaneously using some queueing mechnism.
I am facing below mentioned issue when two excel files have same data. I have tried to dig into code of excel data reader and may be the problem is at logger level. I tried to put lock before ExcelReaderFactory.CreateOpenXmlReader and it resolved below issue but then it does not allow to read
excel files simultaneously as it locks one file and starts to read new only when first is done. (as ExcelReaderFactory is a static class)
--------------Below is error details ----------------------------
ArgumentException
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at Excel.Log.LogManager.Log(String objectName) in LogManager.cs: line 48
at Excel.Core.ZipWorker.NewTempPath() in c:\development\ExcelDataReader\Excel\Core\ZipWorker.cs: line 250
at Excel.Core.ZipWorker.Extract(Stream fileStream) in c:\development\ExcelDataReader\Excel\Core\ZipWorker.cs: line 86
at Excel.ExcelOpenXmlReader.Initialize(Stream fileStream) in c:\development\ExcelDataReader\Excel\ExcelOpenXmlReader.cs: line 335
at Excel.ExcelReaderFactory.CreateOpenXmlReader(Stream fileStream) in c:\development\ExcelDataReader\Excel\ExcelReaderFactory.cs: line 76
at Elastic.Infrastructure.Data.File.Parsers.ExcelOpenXmlStreamReader`2.<Read>d__0.MoveNext() in ExcelOpenXmlStreamReader.cs: line 34
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList(IEnumerable`1 source)
at Elastic.Infrastructure.Data.File.Tests.ExcelOpenXmlStreamReaderTests.<>c__DisplayClass2.<CanIterateThrough2XlsFilesInParallel>b__0() in ExcelOpenXmlStreamReaderTests.cs: line 42
at System.Threading.Tasks.Task.Execute()
--------------------------------------------------------------------------------------------
Please do the needful asap.
Thanks & Regards,
Vibhuti
Commented Unassigned: Numeric strings are converted to numbers [13688]
like 0100 becomes 100.0
If I use ' to force a string it works.
I would be greatful for a quick update.
Comments: ** Comment from web user: sholle **
If the data is stored in the excel sheet as some type of numeric the reader is working correctly. Any formatting performed on the column to make it look like 0100 will not affect the data output. What I could suggest is selecting the entire sheet in excel and forcing it to text format.
I generally do all my data formatting in whatever target system I'm using the data in. There are various ways to right justify zero fill data in most languages. How are you using the data?
Commented Unassigned: Numeric strings are converted to numbers [13688]
like 0100 becomes 100.0
If I use ' to force a string it works.
I would be greatful for a quick update.
Comments: ** Comment from web user: LandLubberNL **
The spreadsheet cell has a formula to extract a piece of a string and the resulting string is a General Ledger name. I can't rely on it to be a certain length, I have to retrieve the actual string that is the result in Excel. (Excel shows it correctly as a string). If it happens to be 00100, the reader returns a datatable with a field of type double and a value of 100.0 , it should be a field of type string, value "00100".
Commented Unassigned: Numeric strings are converted to numbers [13688]
like 0100 becomes 100.0
If I use ' to force a string it works.
I would be greatful for a quick update.
Comments: ** Comment from web user: sholle **
How you format the cell data type does NOT effect the data stored in the cell. If the data is stored as a numeric type it will come out as a decimal type. As far as I know, the reader has no way to determine what formatting you have put on that cell. The formatting is only for viewing in excel, not modifying the stored data. The way you can tell what the underlying excel data looks like is to change the cell to text.
All you have to do is convert 100.0 into whatever format you want once you read it out. Whatever language you are using when you read the data has information on the web on how to turn a numeric value into a formatted left justified 0 filled string. Formatting the excel sheet to look different will not help you at all.
Commented Unassigned: Numeric strings are converted to numbers [13688]
like 0100 becomes 100.0
If I use ' to force a string it works.
I would be greatful for a quick update.
Comments: ** Comment from web user: LandLubberNL **
The data is stored in another cell as '00100 and then collected onto this sheet by means of a lookup. The contents of the cell is 000100 (notice the missing quote). The reader provides me with 100.0, so I can't tell whether it was 100 or 0100 or 00100, which in this application is significant.
Other than that the reader works great.
Created Unassigned: ExcelDataread cannot read google sheet saved as xlsx [13737]
New Post: How do you select a Worksheet for the IExcelDataReader?
FileStream stream = File.Open(@"D:\Transfer\NameSample.xls", FileMode.Open, FileAccess.Read);
IExcelDataReader excelReader = ExcelReaderFactory.CreateBinaryReader(stream);
while (excelReader.Read())
{
this.dataFields = excelReader.FieldCount;
this.dataLabel = excelReader.GetString(0);
this.dataValue = excelReader.GetString(1);
this.dataColor = excelReader.GetString(2);
}excelReader.Close();
Created Unassigned: Trouble accessing ICSharpCode.SharpZipLib.dll in 3rd party software [13760]
Encompass360 has an interface to upload my .NET dll plugin to this system, which works fine.
I am not trying to use Excel Data Reader to read a spreadsheet that is also uploaded to the system. (Love the Data Reader interface.)
Everything works fine as long as I use the binary reader with 97-2003 format .xls files. However, the file size has grown over 64K, so I am trying to use the OpenXmlReader with 2007 format .xlsx files.
The ExcelReaderFactory.CreateOpenXmlReader(stream) returns an IExcelDataReader, but it's IsValid status is false and the Exception property states that the ICSharpCode.SharpZipLib.Zip.ZipEntry.IsCompressionMethodSupported method cannot be loaded.
Calling AsDataSet() on the data reader returns null.
I try to load the SharpZipLib library directly in my plugin, and it fails completely, so I believe the problem is either with the DLL version, or Encompass360s ability to load this dll (even though it loads Excel.4.5.dll just fine - Runtime Version v4.0.30319 and Version 2.1.2.0).
Both dlls work just fine in a .NET Console application, just not within Encompass 360. I've contacted them -- not a lot of help.
My copy of ICSharpCode.SharpZipLib has a modifed date of 1/2/2014 12:05 PM, a Runtime Version of v2.0.50727 and a Version of 0.85.5.452.
Might you have any ideas how to load this dll to get an OpenXmlReader? Perhaps another version?
BTW, this fails for all .xlsx spreadsheets, even the simplest 1 col 1 row test case I created, so I have not attached one.
Thank you very much.
Dave
Created Unassigned: Excel Data Reader unable to read all columns data [13764]
```
IExcelDataReader reader = null;
FileStream stream = System.IO.File.Open(file.FileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
if (file.FileName.EndsWith(".xls"))
{
reader = ExcelReaderFactory.CreateBinaryReader(stream);
}
else if (file.FileName.EndsWith(".xlsx"))
{
reader = ExcelReaderFactory.CreateOpenXmlReader(stream);
}
else
{
reader = null;
}
reader.IsFirstRowAsColumnNames = true;
var exceldata = reader.AsDataSet().Tables[0];
```
I have more than 400 rows and 10 columns in excel But exceldata is returning only first column data. All 400 rows with only first column data.
What i am missing? Please help.
Created Unassigned: Can i read xls file from given url?.. Help me [13767]
Created Unassigned: Reading 2 excel files simultaneously gives an exception [13775]
```
Parallel.Invoke(
()=>
{
FileStream stream = File.Open(@"C:\Projects\TPD.xlsx", FileMode.Open, FileAccess.Read);
IExcelDataReader excelReader = ExcelReaderFactory.CreateOpenXmlReader(stream);
},
() =>
{
FileStream stream = File.Open(@"C:\Projects\TPD1.xlsx", FileMode.Open, FileAccess.Read);
IExcelDataReader excelReader = ExcelReaderFactory.CreateOpenXmlReader(stream);
});
```
I am getting an Exception (An item with the same key already added) in Class LogManager Method Log, where it is trying to add a new logger in the dictionary. This issue is related to synchronization and proposed code to solve this problem is
```
public static ILog Log(string objectName)
{
ILog result = null;
lock (_sync)
{
if (_dictionary.ContainsKey(objectName) == false)
{
_dictionary.Add(objectName, Excel.Log.Log.GetLoggerFor(objectName));
}
result = _dictionary[objectName];
}
return result;
}
```