0 0
Read Time:2 Minute, 57 Second

In this article, I am going to explain to you how to import Excel sheet data to SQL server database table with examples. Here we will be using SQL Server 2019 or you can use SQL Server 2008 or above. In my current project, I am using this concept for data migration.

This concept is used for transferring data from source (Excel sheet) to destination (SQL Server). We can import a bulk amount of excel data into SQL database without using any coding.

There are two ways to import data from excel to SQL Server database. First, if you want to import all excel file data with header names in a new table. Secondly, if you want to append excel data in exiting table data without header names.

Prerequisites

SQL Server 2019 or you can use SQL server 2008 or above version.

Import All Excel Data With Header Names In a New Table

Step 1

Here, I have created a sample Excel data that contains employees detail data with six columns.

How To Import Excel Data Into SQL Server 2019

Step 2

Connect To SQL Server Management Studio 2019 (SSMS) and create a database

Open your SQL Server and use the following script to create the “chittadb” Database.

Create database chittadb

How To Import Excel Data Into SQL Server 2019

Now, select the script query then press F5 or click on Execute button to execute the above script.

You should see a message, “Command(s) completed successfully.” Means your new database is created.

How To Import Excel Data Into SQL Server 2019

Database “Chittadb” created.

How To Import Excel Data Into SQL Server 2019

Step 3

Expand the database where you want to import the data. Here I want to import the data to “Chittadb” database. The database has no table now.

How To Import Excel Data Into SQL Server 2019

Right click your destination database ->Select Tasks -> Import Data

How To Import Excel Data Into SQL Server 2019

Step 4

An Import wizard pop up will open “Welcome to SQL Server Import and Export Wizard” and Click Next.

How To Import Excel Data Into SQL Server 2019

Step 5

  • Now, Select Microsoft Excel as your data source from the dropdown list.
  • Click the ‘Browse’ button to select the path to the Excel data file you want to import.
  • Select the version of the excel file (2007-2010). Is usually fine for files with a .XLS extension, or use newer files with a .XLSX extension)
  • Tick the ‘First Row has column names’ checkbox, if your excel file contains headers.
  • Click next.

How To Import Excel Data Into SQL Server 2019

Step 6

On the ‘Choose a Destination’ Screen, select destination database” SQL Server Native Client 11.0” from the dropdown, select database “chittadb”, also you can use Windows Authentication or Use SQL Server Authentication; here I am using Windows Authentication and click Next.

How To Import Excel Data Into SQL Server 2019

Step 7

Select the Radio button “Copy data from one or more tables or views”.

This step will copy the data from the data source, click next and continue.

How To Import Excel Data Into SQL Server 2019

Step 8

We can specify the table name in the following wizard. So change the destination section name “[dbo].[Sheet1$]” as “[dbo].[Tbl_Employee]” and click Next.

How To Import Excel Data Into SQL Server 2019

How To Import Excel Data Into SQL Server 2019

If you want to preview your data, Click the preview button.

How To Import Excel Data Into SQL Server 2019

Step 9

Save and Run package. Check Run immediately from checkbox and Click Next or Finish button you can get Complete the Wizard page.

How To Import Excel Data Into SQL Server 2019

Step 10

Click finish.

How To Import Excel Data Into SQL Server 2019

Step 11

The execution was successful and Click Close button.

How To Import Excel Data Into SQL Server 2019

Step 12

 Now, check database “Chittadb” and verify.

The following Output contains Id, EmpId, Name, Location, Gender and Designation as the column name and “Tbl_Employee” table also created under database “Chittadb”. Now all excel data is imported to “Tbl_Employee” table.

How To Import Excel Data Into SQL Server 2019

Conclusion

In this article, we learned how to Import Excel data into SQL Server 2019. Post your valuable feedback in the comments section. I hope this article will be useful.

Happy
Happy
0 %
Sad
Sad
0 %
Excited
Excited
0 %
Sleepy
Sleepy
0 %
Angry
Angry
0 %
Surprise
Surprise
0 %
Rate this post
error: Content is protected !!