Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

column skiped #160

Open
no1traveller opened this issue Jan 4, 2019 · 6 comments
Open

column skiped #160

no1traveller opened this issue Jan 4, 2019 · 6 comments
Assignees

Comments

@no1traveller
Copy link

no1traveller commented Jan 4, 2019

image

image

var worksheetName = excel.GetWorksheetNames().FirstOrDefault();
columns = excel.GetColumnNames(worksheetName).ToList();
var named=excel.GetNamedRanges(worksheetName);
if (worksheetName != null)
{
    records = excel.Worksheet(worksheetName).ToList();
}

this should be pretty self explanatory. its skipping the first column. this is pretty basic functionality and im disappointed its falling over at this stage.

@mrworkman
Copy link
Collaborator

It would be helpful if you also attach an affected xls/xlsx file as well (I don't need the actual data you're using, just some that presents the same issue). I can just type in the data you've provided in your screenshot, but that doesn't always work in reproducing the issue.

@no1traveller
Copy link
Author

I've Attached the file

@mrworkman
Copy link
Collaborator

I will try to look at this today.

@mrworkman mrworkman self-assigned this Jan 14, 2019
@mrworkman
Copy link
Collaborator

I don't see any attachments.

Anyway, as I suspected, when filling in a spreadsheet myself, I do not see the issue you're talking about.

image

I need more to go on than you've given me.

  1. What version of LinqToExcel are you using?
  2. 32 or 64 bit?
  3. ACE or Jet?
  4. Please attach a spreadsheet that has the problem.
  5. Please attach a project/solution that exhibits this behaviour. Your code snippet above is incomplete.

@mrworkman
Copy link
Collaborator

Also, you don't indicate which variable you're inspecting. I had to assume it was "records".

@aswanson08
Copy link

I'm experiencing a similar issue, although based on my testing it appears to be skipping the first column if all of the cells are empty. In the linked file, if I change cell A1 to be a single space character, it finds the column. Otherwise, it does not.

This makes it difficult to use across a large set of files that all have the same template (but don't adhere to mappable format), as the columns may be shifted depending on their content.

Answering your questions from above:

LinqToExcel 1.11.0

  1. LinqToExcel 1.11.0
  2. 32 bit (on a 64 bit machine)
  3. Default (Jet)
  4. GitHub won't allow attaching a .XLS, can be downloaded here
  5. Running in LINQPad 5 as "C# Statement(s)", but will try in VS2019 if you are unable to reproduce:
    var excel = new ExcelQueryFactory(@"Path\to\BadFirstColumn.xls"); var worksheet = excel.WorksheetNoHeader("Sheet1"); Console.WriteLine("Cell E1 should be empty."); Console.WriteLine($"Cell E1 contents: {worksheet.First()[4].Value}"); try { Console.WriteLine("Cell F1 should have content:"); Console.WriteLine($"Cell F1 contents: {worksheet.First()[5].Value}"); } catch(ArgumentOutOfRangeException) { Console.WriteLine("Cell F1 does not exist."); }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants