what is the best way to import excel data to one of the Database table in Sql Server
Loading
what is the best way to import excel data to one of the Database table in Sql Server
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Vishal YelvePosted Jul 26, 2024, 1:39 PM
Hi Abhishek,
do refer to my article.
https://www.c-sharpcorner.com/article/how-to-read-data-from-an-excel-sheet/
Ivonne AspilcuetaPosted Jul 25, 2024, 3:43 PM
Hi!
Yes, those steps I explained below the comments are for one table, but if you are looking to add data for multiple tables what you can do is:
Instead of importing the excel to a table in SQL, import it into a Temp table on SQL server. Then you will be able to write a query which retrieves all the data from the Temp table, to make joins it to the other tables and then inserts into those tables if you have a relational database.
OR multiple excel
You can use SSIS:
https://www.youtube.com/watch?v=gAJUt65_Tcs
Nikunj SatasiyaPosted Jul 25, 2024, 8:16 AM
Abhishek, you can take refrence from my article.
Article Link:
https://www.codingvila.com/2021/02/upload-and-read-excel-file-in-web-api.html
Abhishek ChadhaPosted Jul 25, 2024, 1:48 AM
For existing tables - by this way can we import just one table
Ivonne AspilcuetaPosted Jul 24, 2024, 9:50 PM
1) Make sure your spreadsheet is clean and all columns align to the correct data (Make sure there are no strings of data out of place).
2) Create a Database or existing Database, avoid to use the system databases.
3) right click on the base, choose: Task - Import Flat File and follow the instructions.
For existing Tables:
1) Make sure your spreadtsheet matches columns names and datatype from SQL Table
2) right click on the databse where your existing tables is and choose Task- Import data.
3) Export wizard, click next and choose your data source: Microsoft Excel and upload your file.
4) Follow instructions