Closed GoogleCodeExporter closed 8 years ago
Can you attach the spreadsheet you are working with.
Original comment by paulyo...@gmail.com
on 29 Jun 2010 at 12:25
Here it is
Original comment by toudi...@o2.pl
on 30 Jun 2010 at 6:28
Attachments:
I did half an hour of research on the web and couldn't find out why the
spreadsheet has this hidden name.
Original comment by paulyo...@gmail.com
on 7 Jul 2010 at 5:44
Like PrintArea FilterDatabases are hidden worksheets. In my opinion
GetWorksheetNames should not return names of hidden worksheets. See the
following code that runs into an exception:
var excel = new ExcelQueryFactory(Filename);
var workSheetsNames = excel.GetWorksheetNames();
foreach(var name in workSheetsNames)
{
Console.WriteLine("Columns of Worksheet '{0}':",name);
var columnNames = excel.GetColumnNames(name);
foreach (var columnName in columnNames)
{
Console.WriteLine("\t{0}",columnName);
}
}
Please note the $ sign in the name below
System.Data.OleDb.OleDbException : 'Excel_BuiltIn__FilterDatabase_3$' is not a
valid name. Make sure that it does not include invalid characters or
punctuation and that it is not too long.
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult
hr)
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS
dbParams, ref Object executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommandText(ref Object executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, ref
Object executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior
behavior, String method)
at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.OleDb.OleDbCommand.ExecuteReader()
at LinqToExcel.Query.ExcelUtilities.GetColumnNames(String WorksheetName, String
FileName)
at LinqToExcel.ExcelQueryFactory.GetColumnNames(String WorksheetName)
at My.Tests.ExcelFileReaderTest.ExcelWorkBookTest() in ExcelFileReaderTest.cs:
line 22
Original comment by pietvred...@gmail.com
on 6 Sep 2010 at 10:06
In order to get it working for me I've replaced the
ExcelUtilities.GetWorksheetNames
with the following code:
internal static IEnumerable<string> GetWorksheetNames(string fileName)
{
var worksheetNames = new List<string>();
using (var conn = new OleDbConnection(GetConnectionString(fileName)))
{
conn.Open();
using (var excelTables = conn.GetOleDbSchemaTable(
OleDbSchemaGuid.Tables,
new Object[] {null, null, null, "TABLE"}))
{
worksheetNames.AddRange(
(from DataRow row in excelTables.Rows
let worksheetName = row["TABLE_NAME"].ToString()
select worksheetName.Remove(worksheetName.IndexOf("$")).Replace("'", "")).Distinct());
}
}
return worksheetNames;
}
But for real i still don't understand the Excel_BuiltIn__FilterDatabase_3
problem...
Original comment by pietvred...@gmail.com
on 6 Sep 2010 at 12:27
I agree. I'll work on apply the patch.
Original comment by paulyo...@gmail.com
on 7 Sep 2010 at 4:11
This is fixed in version 1.4.81
Original comment by paulyo...@gmail.com
on 21 Sep 2010 at 2:37
Original issue reported on code.google.com by
toudi...@o2.pl
on 29 Jun 2010 at 12:21