Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create an SQL table and and populate it with Excel spreadsheet data?

Is there an easy way to create a table in SQL Server (2005) from an Excel spreadsheet. I'm thinking maybe some tool?

Thanks in advance.

like image 417
Alonso Avatar asked Oct 07 '08 15:10

Alonso


People also ask

How do I create a SQL data table from Excel?

Click a cell within your data range. Press CTRL + T (hold down the CTRL-key and press T) The Create Table dialog will be shown: Click OK and your data will now be in an Excel table.

How do you create a table and insert value from Excel in SQL?

First, copy the data from Excel, and then paste it into the SQL Server table using the Database > Table > Edit top 200 rows menu option. Always start by copying and pasting a single row of data to validate the data types.

How do I use Excel spreadsheet in SQL?

Open an SQL connection to an Excel file Before running an SQL query, you have to open a connection with the Excel file you want to access. To establish the connection, create a new variable named %Excel_File_Path% and initialize it with the Excel file path.

Can Excel Write to SQL database?

You can use an Excel AddIn such as SQL Spreads (www.sqlspreads.com) to let your end users push the data directly from Excel to SQL Server. It can also handle different number of rows.


2 Answers

SQL Server 2008R2+

  1. Right click the database
  2. Tasks
  3. Import Data
  4. Excel as Source
  5. choose an XLXS, XLS, etc... Good to go :)
like image 56
bird2920 Avatar answered Sep 17 '22 23:09

bird2920


Save excel file as text(unicode) file and then use "sql import and export data" from all programs then select "flat file source" as file source and browse the txt file.Thats it.Simple and clear.

like image 45
Abhinava Shukla Avatar answered Sep 19 '22 23:09

Abhinava Shukla