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

Failure to map columns with square brackets in the header row #180

Open
JeremyMahieu opened this issue May 19, 2020 · 1 comment
Open

Failure to map columns with square brackets in the header row #180

JeremyMahieu opened this issue May 19, 2020 · 1 comment

Comments

@JeremyMahieu
Copy link

I have an excel that looks like in the screenshot.
image
TestFileHeaders.xlsx

My mapping class looks like this.

public class UnitExcelRow
    {
        [ExcelColumn("barcode")]
        public string Barcode { get; set; }

        [ExcelColumn("gross [ kg]")]
        public string GrossWeight { get; set; }
    }

And the code looks like this:

var unitRaw = excel.Worksheet<UnitExcelRow>(0) // 0 for first worksheet<
  .ToList(); 

I only get null for GrossWeight. I'm not sure why it's not working, if I change the header to "test" it works. I assume it's the square brackets that are not working.

@CPerry-COV
Copy link

In a similar vein, I have a column header "Date/Time" and when I trying to select and filter on that column "from c in worksheet where c["Date/Time"] <... it comes back with an error that "..."Date/Time" is not a valid column name. Valid column names are... xxx, "Date/Time", yyy..."

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

No branches or pull requests

2 participants