How To Import Excel Sheet In SQL | Blogz Den

How to import excel sheet in SQL? 

Via 8 easy steps you will know how to import excel sheet in SQL. Then add same sheet data into existing table.



1. Maintain Excel sheet and save as Microsoft Excel .97-2003 Worksheet.xls
2. Then go to SQL and Right Click on Database and click on "Task" and click "Import Data"
 


3. Click on choose Data source, File Path and Excel File Version. (Tick ✔ First row has column name if your file has)


4. Select Destination, Server Name, and Database (on which you want to add excel sheet.)


5. Tick copy data from one or more tables or views.


6. Notice your Excel Tab Name will show and with same name table will create on your Database.


7. Tick "Run Immediately" and press next

8. Last step press Finish and wait.


  • Then you will see your data in newly created table which will show here.


How to Add your Excel data into existing Table?


SQL Query:

INSERT INTO [common.remitanywhere].[dbo].[tbworldbanks] --- (Existing Table)
           ([CountryKey]
          ,[CountryName]
          ,[CountryCode]
          ,[BankName]
          ,[BankCode]
           )
SELECT 
            [CountryKey]
          ,[CountryName]
          ,[CountryCode]
          ,[Bank Name]
          ,[BankCode]
FROM [common.remitanywhere].[dbo].[chezbanks$] --- (Newly Created Table)


@: The above query will select your data from newly created table (after importing excel sheet) and insert into your existing table.

For Reference:

  

No comments

Powered by Blogger.