Make ResetSheetData method public
See original GitHub issueIn version 3.0
you’re added the IExcelDataReader.Reset
method, which resets reader to the beginning of workbook.
In our project, we often need to reset a worksheet, not a whole workbook reading state. So, I propose to make ResetSheetData
method public
and add it to the IExcelDataReader
interface (currently, ResetSheetData
is owned by ExcelDataReader
abstract class. Or, maybe overloaded Reset
method is enough (like reader.Reset(worksheet: true)
).
Now, we are using reflection to emulate that behavior:
^ look at the dictionary, base type for the ExcelBinaryReader
is not same as base type of the ExcelOpenXmlReader
.
Issue Analytics
- State:
- Created 4 years ago
- Comments:6
Top Results From Across the Web
Get only public methods of a class using Java reflection
For example, I have a private getNode method that, while the "modifiers" value appears as 2 in the debugger, it outputs as "1"...
Read more >Google Apps Script, Sheets, Cloud and Automation
There is a simple way to reset sheet data. ... Create google sheets with specific name of column , share the file to...
Read more >C# (CSharp) IEnumerator.Dispose Examples
In this example, we implement the IEnumerator and IDisposable interfaces to create a custom enumerator. The Dispose method simply writes to the console...
Read more >Uipath Convert Excel To Pdf
NET offers a method to convert Excel to PDF, I. You can read and separately extract the content of. UiPath Extract PDF Text...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi,
I share @appel1’s concerns, and would have tested the reflection based approach myself provided the actual code rather than a screenshot 😃 The proposed solution with
Reset()
andNextResult()
should be both safe and performant, because previously read worksheet metadata are cached internally in the reader. Only (minor) drawback is it requires a sheet index to reset to.This is a valid feature request however, and adding new
ResetResult()
method or something makes sense for use cases like this.ResetSheetData works the same way in 3.6.0 as it does in head of develop so then I don’t see how it could possible do what you describe. Are you perhaps checking the Depth property to determine what row you are reading? Calling ResetSheetData will make Depth start over from 0 but will not actually make Read start over from the first row of the current sheet. https://github.com/ExcelDataReader/ExcelDataReader/blob/e5b7d41b580603c866b9097496139080c0bba105/src/ExcelDataReader/ExcelDataReader.cs#L295-L299
What do you think about the solution I posted here? Any reason that doesn’t work for you?