paulyoder / LinqToExcel

Use LINQ to retrieve data from spreadsheets and csv files
MIT License
1.06k stars 299 forks source link

GetWorksheetNames not returning actual name when sheet name contains $ #152

Closed sameerkattel closed 6 years ago

sameerkattel commented 6 years ago

When a worksheet name contains $ sign "APPO $50" then

excel.GetWorksheetNames() returns only "APPO 50" which causes issue when trying to query excel using the sheet name.

I think this piece is where the replacement happens. https://github.com/paulyoder/LinqToExcel/blob/ff42b206fdc2ffbe7673eb2b320f5455c7b73720/src/LinqToExcel/Query/ExcelUtilities.cs#L97

Not sure why here it replaces all the $ sign from table name.

mrworkman commented 6 years ago

Every table (worksheet) retrieved by OLEDB has a $ at the end of it, which is not displayed in Excel, and thus is not part of the worksheet's name, so I'm guessing Paul was just trying to accommodate that.

mrworkman commented 6 years ago

Fixed on master.