Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88030

User Mapping Excel column names to SQL DB table column names prior to import. ASP.NET MVC/Razor

$
0
0

I have an ASP.NET MVC application connected to my SQL database with set tables and column names. Each time they the use the app, the user has to import two Excel files which will be imported into two of the tables. These files may have loads of columns and some may even be spelled differently than their corresponding columns in the database. As such, I need the user to be able to map the Excel columns to the database columns before importing.

Currently, I fix the Excel file, which then gets added to a DataTable, after which I use a SQL bulk copy to the database table. Instad, I wanted to bind this DataTable to a dropdown list for the user to map each Excel column to a corresponding table heading. As I will not know what the headings are in Excel (and, thus, in the DataTable), however, I am finding it hard to bind to a dropdown list. Also, I cannot use models for my database table as it is only the column headings I need and not the values themselves.

I am using a SQL data adapter to connect to my database. The closest solution I have found doesn't address my problem, as I am using MVC Razor, whereas it is using ASP.NET Web Forms.

Does anyone know the best way to allow the user to map the Excel columns to the SQL table headings, and then use those to import the Excel data into the database afterwards?

Thanks in advance.


Viewing all articles
Browse latest Browse all 88030

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>