Skip to main content linkedinfacebooktwittermenuarrow-up

ExportToDataGridView Option to discover a "Header Row" based on a search capability Completed

Often we do not know which row in a user's Excel file the header row is positioned, so we can not specify any start row position.


Users tend to add arbitrary numbers of rows at the start of an Excel file for use as "advanced filters". Because of this, the ExportToDataGridView converter is not able to set up column names for the DataGridView. What we need is a mechanism where the programmer can specify two unique strings or a cell format type that would always be present in the header of a user's .xlsx file. The ExportToDataGridView converter would scan the file in reverse row order for the first row that contains one or more cells set to the text value or a cell format equal to the format specifier, and then use that row as the header row for naming DataGridView columns.


The searching has to be done in reverse row order starting at up to say 1000 rows, because when "advanced filters" are used in a user's Excel file, there is a duplicated header row, then arbitrary number of advanced filter rows, and then the actual header row starts, followed by the user's data rows.

Official response

Mario at GemBox


This feature request has been implemented and is available in the latest versions of GemBox.Spreadsheet.