Sylvan.Data.Excel icon indicating copy to clipboard operation
Sylvan.Data.Excel copied to clipboard

want to be able to set ExcelDataReader.SheetNames PUBLIC

Open lileyzhao opened this issue 2 years ago • 4 comments

For some usage scenarios, I want to be able to set the access scope for SheetInfo[] sheetNames in ExcelDataReader to public,

Now I can only use the source code to get SheetInfo[]

lileyzhao avatar Aug 31 '22 01:08 lileyzhao

For some usage scenarios

Can you describe the scenario?

MarkPflug avatar Aug 31 '22 14:08 MarkPflug

My English is written through translation, maybe the vocabulary is not particularly accurate.

For example, my users spread their data across multiple sheets, and sometimes no, I want to be able to choose which sheets to import based on the user's discretion, so I want to get the sheet List

lileyzhao avatar Sep 01 '22 07:09 lileyzhao

This is a reasonable request, but I'll have to give it some thought. I don't want to just make the sheet names public, because I feel like for this to be useful, a user would also want to "open" each specific sheet. Currently the "NextResult" is the way to do this, but that only allows moving forward through the sheets. If someone opened a specific sheet, what should happen when NextResult is called? Presumably, it would move to the next sheet.

For now, you can open the sheet twice: the first time through call NextResult and WorksheetName to get the ordered list of worksheets. Then, close and reopen the file and use the sheetnames to provide the user options.

MarkPflug avatar Sep 01 '22 16:09 MarkPflug

You're right, we're more of a financial business, where multiple pieces of data are mixed into one file through different worksheets, so you need to specify a specific sheet for import.

It is possible to open the sheet twice. I can work like this for a while.

lileyzhao avatar Sep 02 '22 05:09 lileyzhao

@MarkPflug Hello, do you have a plan to disclose the ExcelDataReader.SheetNames

lileyzhao avatar Nov 07 '22 05:11 lileyzhao

No, I don't have any immediate plans to add this feature.

MarkPflug avatar Nov 17 '22 16:11 MarkPflug

This is being added in 0.4.6-b0001 (prerelease currently). ExcelDataReader now has a "WorksheetNames" enumeration, and a TryOpenWorksheet(string name) method. Not sure when the final 0.4.6 build will be released, there are some other things I'm trying to incorporate.

MarkPflug avatar Feb 10 '23 23:02 MarkPflug

Wow, finally support. Thank you very, very much

lileyzhao avatar Feb 15 '23 09:02 lileyzhao