1
Answer

Excel data import mapping to datagridview

Charlie

Charlie

12y
2.1k
1

Hi all,

I have an Excel spreadsheet that I am importing into a datagridview.

Unfortunately the Excel spreadsheet comes from an external source that I have no control over and they often change the column order, headings, etc. All in all I cannot rely on a specific column in the spreadsheet being in a specific place in the order. What I am looking to do is to have an intermediate step where I can specify the excel spreadsheet name, and location, select the specific worksheet and then be able to "map" the Excel columns to specific columns in the datagridview.

Example :-
Column1 in the worksheet maps to Column2 in the datagridview,
Column2 in the worksheet maps to Column4 in the datagridview,
Column3 in the worksheet maps to Column3 in the datagridview,
Column4 in the worksheet maps to Column1 in the datagridview,

I need to "map", or aling, the columns as I need the data in a specific order in the datagridview.

I am able to select the spreadsheet and the relevant sheet however I can't find a way to "map", or align, the columns.

Any advice, pointers, or assistance greatly appreciated.

Thanks

Charlie

Answers (1)