codeice / linqtoexcel

Automatically exported from code.google.com/p/linqtoexcel
0 stars 0 forks source link

not a valid column name when indexing row #93

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I'm getting the following error:

"'onvert(-1.get_Item(0)' is not a valid column name. Valid column names are: 
'Make', 'Model', 'Headline', 'Text1', 'Text2', 'Text3'"

Original issue reported on code.google.com by f.loe...@gmail.com on 8 Oct 2013 at 9:03

GoogleCodeExporter commented 8 years ago
Can you show me the code you're using.

Original comment by paulyo...@gmail.com on 8 Oct 2013 at 3:40

GoogleCodeExporter commented 8 years ago
Hi

I'm getting the same problem with a file, but it seems to be heading related.
All that is required from the code is to count sheets, then count the rows in 
each sheet.

//Get sheet Names
var wb = new ExcelQueryFactory(fullPath);
                        var workSheetNames = wb.GetWorksheetNames();

                        string[] sheetNames = workSheetNames as string[] ?? workSheetNames.ToArray();

//Count Rows
                        string[] sheetNames = workSheetNames as string[] ?? workSheetNames.ToArray();
                        sheetNames = sheetNames.Where(val => !val.Contains("_xlnm#")).ToArray();
                        var sheetCount = sheetNames.Count();
                        var rowcounter = sheetNames.Select(workSheet =>
                        {
                            workSheet = workSheet.Replace("\"","");
                            workSheet = workSheet.Replace("'", "");
                            return (wb.Worksheet(workSheet).Select(row => row));
                        }).Select(rows =>
                        {
                                return rows.Count() + 1; //ERROR HERE
                        }).ToList();

ERROR:
'Debt Sizingtarget_dscr' is not a valid worksheet name. Valid worksheet names 
are: 'Appendix R6', 'Appendix R7', 'BackLeverage', 'CPI adjusted Statements', 
'DBSA Sens', 'Debt Sensitivities', 'Debt Sizing', 'Debt Sizing'target_dscr', 
'DS Reports', 'Early Operating Period', 'Fin Model', 'Fin Model'actual_tenor', 
'Fin Model'adminexpense', 'Fin Model'assetinsurance', 'Fin Model'biyear', 'Fin 
Model'biyear2', 'Fin Model'check', 'Fin Model'csr', 'Fin Model'depr', 'Fin 
Model'deprbook', 'Fin Model'depreciation', 'Fin Model'dsraamount', 'Fin 
Model'dsracalc', 'Fin Model'dsraflows', 'Fin Model'dsraint', 'Fin 
Model'dsrares', 'Fin Model'generation', 'Fin Model'inverter', 'Fin Model'IT', 
'Fin Model'lease', 'Fin Model'loanmaintenance', 'Fin Model'mmres', 'Fin 
Model'OnM', 'Fin Model'PRI', 'Fin Model'quarter', 'Fin Model'revenue', 'Fin 
Model'taxstart', 'Fin Model'termloanint', 'Fin Model'termloanprin', 'Fin 
Model'trf', 'Fin Model'unlevtax', 'Fin Model'vatexpense', 'Fin Model'writeoff', 
'Fin Model'year', 'Fin Model'year2', 'Hedging Template', 'Inputs', 'Inputscod', 
'Inputsdebt_equity_ratio', 'Inputsinterest', 'Inputsirrval', 'Inputsppaterm', 
'Inputssys_size', 'Inputstenor', 'Inputsusd', 'Outputs', 'Pre COD', 'Project 
Accounts', 'RFP Information', 'RFP Output Page', 'RFP Sens', 'Schedules', 'Semi 
Annual Statements', 'Semi Annual Statements'exch', 'Semi Annual 
Statements'mill', 'Semi Annual Statements'precission', 'Stub Period', 'TOC', 
'User'

Why is the "GetWorksheetNames" function getting "Named Group Cells" as well, is 
there a way to get the list of valid worksheets then I can just test it against 
it. 

Original comment by Ascended...@gmail.com on 18 Feb 2014 at 6:54

Attachments: