How skip rows and cells to create the dataset?
See original GitHub issueHi guys.
We are using ExcelDataReader
and ExcelDataReader.DataSet
extension available on NuGet, to have the IExcelDataReader
instance as DataSet
. It works perfectly for the most of our scenarios and it show us such as a great tool.
There are some scenarios where we need to define the row and column (for sample: B3
or D4
or E10
), where should start reading data and build the dataSet. For sample, I have worksheets where the data that interest me to extract start on F2
column (where F2
is the header line and above it the data).
Is there any way to specify what cell the DataSet
should start reading using the configuration objects? Or how rows it should skip (for sample, 6 lines and start reading)?
Thank you.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5
Top Results From Across the Web
How to skip rows while reading csv file using Pandas?
How to skip rows while reading csv file using Pandas? ; use_cols, This parameter is Only uses the passed col[string list] to make...
Read more >Import CSV Files As Pandas DataFrame With skiprows ...
Here skiprows = 1, means delete one row. By default, it will delete one row from the top. You can delete 2, 3,...
Read more >Skip rows with datasets.Dataset.map()
Is there a way to skip rows, i.e. how do I make 0 rows in the new dataset from a row in the...
Read more >Skip data rows and select specific data | EXCEL - YouTube
Skip data rows and select specific data | EXCEL · 007 - Excel: Split one data column into multiples · 4 Ways to...
Read more >How to Skip a Line in Excel – Skipping Blank Lines
Choose a row or column that is needed to be skipped. · Click on the Insert option given at the upper side of...
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!
Alas there is no way to exclude columns with AsDataSet currently.
But there are two options for skippings rows. The simplest is probably to use the
FilterRow
callback:The above reads only rows when the
Depth
(row index) is greater than 6.Can also skip rows before the header, with
UseHeaderRow = true
, and theReadHeaderRow
callback:The above skips the 6 first rows, uses the next row as headers, then reads the rest as normal.
Which approach to use probably depends on the use case
I think your first sample looks OK - it does what it needs to do. Alternatively, initialize the for-loop with the first column index to avoid the if-continue statement, f.ex
for (int c = 1; c < table.Columns.Count; c++)...
The AsDataSet() options could use a new
ExcelDataTableConfiguration.FilterColumn
callback to configure which columns to read into the dataset. This would complement theFilterRow
callback.EDIT: Another request for the same https://github.com/ExcelDataReader/ExcelDataReader/issues/213#issuecomment-308731323