---
description: In this tutorial, we are going to import data from a SQL external database. This exercise assumes you have a working instance of SQL Server and basics of SQL Server. First we create SQL file to import
title: How to Import SQL Database Data into Excel File [Example]
image: https://www.guru99.com/images/how-to-import-sql-database-into-excel.png
---

 

[Skip to content](#main) 

**⚡ Smart Summary**

Importing SQL database data into Excel links a worksheet to a live table in SQL Server or Access. This page creates a sample employees table, imports it through the Data Connection Wizard, imports an Access table, and covers refreshing the connection.

* 🗄️ **Source:** The data comes from an external SQL Server or Microsoft Access database rather than from inside Excel.
* 🧱 **Prepare:** A CREATE TABLE and INSERT script builds a sample employees table to import.
* 🔌 **Connect:** The DATA tab, From Other Sources, From SQL Server opens the Data Connection Wizard.
* 🔑 **Authentication:** A local server can use Windows authentication, while a remote server needs a user id and password.
* 📋 **Select:** Pick the database and the table, save the connection, and place the data in the worksheet.
* 🗂️ **Access:** The From Access button imports a table from a Microsoft Access database in the same way.
* 🔄 **Refresh:** Data, Refresh All updates the imported table whenever the database changes.

[ Read More ](javascript:void%280%29;) 

![How to Import SQL Database into Excel](https://www.guru99.com/images/how-to-import-sql-database-into-excel.png)

## Import SQL Data into Excel File

In this tutorial, we are going to import data from a external SQL database. This exercise assumes you have a working instance of SQL Server and basics of SQL Server.

First we create [SQL](https://www.guru99.com/sql.html) file to import in Excel. If you have already SQL exported file ready, then you can skip following two step and go to next step.

1. Create a new database named EmployeesDB
2. Run the following query

USE EmployeeDB
GO

CREATE TABLE [dbo].[employees](
	[employee_id] [numeric](18, 0) NOT NULL,
	[full_name] [nvarchar](75) NULL,
	[gender] [nvarchar](50) NULL,
	[department] [nvarchar](25) NULL,
	[position] [nvarchar](50) NULL,
	[salary] [numeric](18, 0) NULL,
 CONSTRAINT [PK_employees] PRIMARY KEY CLUSTERED
(
	[employee_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

INSERT INTO employees(employee_id,full_name,gender,department,position,salary)
VALUES
('4','Prince Jones','Male','Sales','Sales Rep',2300)
,('5','Henry Banks','Male','Sales','Sales Rep',2000)
,('6','Sharon Burrock','Female','Finance','Finance Manager',3000);

GO

## How to Import Data to Excel using Wizard Dialog

* Create a new workbook in [MS Excel](https://www.guru99.com/introduction-to-microsoft-excel.html)
* Click on DATA tab

[](https://www.guru99.com/images/5-2015/050215%5F1128%5FConnectingM14.png)

1. Select from Other sources button
2. Select from SQL Server as shown in the image above

[](https://www.guru99.com/images/5-2015/050215%5F1128%5FConnectingM15.png)

1. Enter the server name/IP address. For this tutorial, am connecting to localhost 127.0.0.1
2. Choose the login type. Since am on a local machine and I have windows authentication enabled, I will not provide the user id and password. If you are connecting to a remote server, then you will need to provide these details.
3. Click on next button

Once you are connected to the database server. A window will open, you have to enter all the details as shown in screenshot

[](https://www.guru99.com/images/5-2015/050215%5F1128%5FConnectingM16.png)

* Select EmployeesDB from the drop down list
* Click on employees table to select it
* Click on next button.

It will open a data connection wizard to save data connection and finish the process of connecting to the employee’s data.

[](https://www.guru99.com/images/5-2015/050215%5F1128%5FConnectingM17.png)

* You will get the following window

[](https://www.guru99.com/images/5-2015/050215%5F1128%5FConnectingM18.png)

* Click on OK button

[](https://www.guru99.com/images/5-2015/050215%5F1128%5FConnectingM19.png)

[Download the SQL and Excel File](https://drive.google.com/uc?export=download&id=1kJTZAfpH-WugRnUr3%5FXtzlbTUgAFEfU0)

### RELATED ARTICLES

* [How to Open & Convert XML File to Excel ](https://www.guru99.com/connecting-microsoft-excel-to-external-data-sources.html "How to Open & Convert XML File to Excel")
* [Top 10 Excel Formulas Interview Questions and Answers (2026) ](https://www.guru99.com/excel-formulas-interview-questions.html "Top 10 Excel Formulas Interview Questions and Answers (2026)")
* [6 BEST Data Entry Courses & Certificates (2026) ](https://www.guru99.com/best-data-entry-courses-and-online-training.html "6 BEST Data Entry Courses & Certificates (2026)")
* [9 BEST Financial Modeling Courses (2026) ](https://www.guru99.com/best-financial-modeling-courses-online-certifications.html "9 BEST Financial Modeling Courses (2026)")

## How to Import MS Access Data into Excel with Example

Here, we are going to import data from a simple external database powered by Microsoft Access database. We will import the products table into excel. You can download the [Microsoft Access database](https://www.guru99.com/ms-access-tutorial.html).

* Open a new workbook
* Click on the DATA tab
* Click on from Access button as shown below

[](https://www.guru99.com/images/5-2015/050215%5F1128%5FConnectingM1.png)

* You will get the dialogue window shown below

[](https://www.guru99.com/images/5-2015/050215%5F1128%5FConnectingM2.png)

* Browse to the database that you downloaded and
* Click on Open button

[](https://www.guru99.com/images/5-2015/050215%5F1128%5FConnectingM3.png)

* Click on OK button
* You will get the following data

[](https://www.guru99.com/images/5-2015/050215%5F1128%5FConnectingM4.png)

[Download the Database and Excel File](https://drive.google.com/uc?export=download&id=1qV-EHWE9ZSbIHFT4ATz8JLqrD8TeXDpL)

## Refreshing and Managing the Database Connection

The advantage of importing over pasting is that Excel keeps a live connection to the database, so a single refresh brings in the latest rows without repeating the wizard. Managing that connection keeps the report both current and secure.

1. **Refresh the data:** Click any cell in the imported table, open the DATA tab, and choose Refresh, or Refresh All to update every connection.
2. **Refresh on open:** In Connection Properties, tick “Refresh data when opening the file” so the report is up to date every time it is opened.
3. **Manage connections:** Use Queries & Connections to rename, edit, or delete a connection, and to check the server and database it points to.
4. **Protect credentials:** Prefer Windows authentication where possible, and never save a database password in a shared workbook.

**⚠️ Warning:** A workbook that carries a live database connection can expose the server name and the query. Remove the connection with Queries & Connections before sharing the file outside the organisation, or paste the values as static data first.

## FAQs

⚡ What is the difference between Windows and SQL Server authentication?

Windows authentication signs in with the current Windows account, so no password is typed, which suits a local server. SQL Server authentication needs a separate user id and password, and is used for remote servers.

🔄 Does the Excel table update when the database changes?

Only after a refresh. The imported table keeps a connection but does not update on its own. Click Refresh on the DATA tab, or set the connection to refresh when the file opens, to see the newest rows.

📊 Can I import the result of a SQL query instead of a whole table?

Yes. In the connection properties, change the command type to SQL and paste a SELECT statement. Excel then imports only the rows and columns that the query returns, which is faster for a large table.

🤖 Can AI write the SQL query for an Excel import?

Yes. AI features such as Copilot turn a plain request like “employees in Sales earning over 2000” into a SELECT statement. The user reviews the query and pastes it into the connection before importing.

🧠 Can AI analyse the data after it is imported from SQL?

Yes. AI assistants summarise the imported table, build a pivot or chart, and answer questions about it in plain language. The live connection means a refresh keeps the analysis current with the database.

#### Summarize this post with:

ChatGPT Perplexity Grok Google AI 

**Stay Updated on AI** **Get Weekly AI Skills, Trends, Actionable Advice.** 

##### Sign up for the newsletter

Subscribe for Free 

You have successfully subscribed.  
Please check your inbox. 

![AI-Newsletter]() Chosen by over **350,000+** professionals 

[Scroll to top ](#wrapper)Scroll to top 

× 

Toggle Menu Close 

Search for: 

Search

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://www.guru99.com/#organization","name":"Guru99","sameAs":["https://www.facebook.com/Guru99Official","https://twitter.com/guru99com"],"logo":{"@type":"ImageObject","@id":"https://www.guru99.com/#logo","url":"https://www.guru99.com/images/guru99-logo-v1-150x59.png","contentUrl":"https://www.guru99.com/images/guru99-logo-v1-150x59.png","caption":"Guru99","inLanguage":"en-US"}},{"@type":"WebSite","@id":"https://www.guru99.com/#website","url":"https://www.guru99.com","name":"Guru99","publisher":{"@id":"https://www.guru99.com/#organization"},"inLanguage":"en-US"},{"@type":"ImageObject","@id":"https://www.guru99.com/images/how-to-import-sql-database-into-excel.png","url":"https://www.guru99.com/images/how-to-import-sql-database-into-excel.png","width":"700","height":"250","caption":"How to Import SQL Database into Excel","inLanguage":"en-US"},{"@type":"BreadcrumbList","@id":"https://www.guru99.com/import-sql-data-excel.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":"1","item":{"@id":"https://www.guru99.com","name":"Home"}},{"@type":"ListItem","position":"2","item":{"@id":"https://www.guru99.com/excel","name":"Excel"}},{"@type":"ListItem","position":"3","item":{"@id":"https://www.guru99.com/import-sql-data-excel.html","name":"How to Import SQL Database Data into Excel File [Example]"}}]},{"@type":"WebPage","@id":"https://www.guru99.com/import-sql-data-excel.html#webpage","url":"https://www.guru99.com/import-sql-data-excel.html","name":"How to Import SQL Database Data into Excel File [Example]","dateModified":"2026-07-15T13:25:27+05:30","isPartOf":{"@id":"https://www.guru99.com/#website"},"primaryImageOfPage":{"@id":"https://www.guru99.com/images/how-to-import-sql-database-into-excel.png"},"inLanguage":"en-US","breadcrumb":{"@id":"https://www.guru99.com/import-sql-data-excel.html#breadcrumb"}},{"@type":"Person","@id":"https://www.guru99.com/author/charlotte","name":"Charlotte Miller","description":"I am Charlotte Miller, an Excel VBA Developer with over a decade of first-hand experience.","url":"https://www.guru99.com/author/charlotte","image":{"@type":"ImageObject","@id":"https://www.guru99.com/images/charlotte-miller-author.png","url":"https://www.guru99.com/images/charlotte-miller-author.png","caption":"Charlotte Miller","inLanguage":"en-US"},"worksFor":{"@id":"https://www.guru99.com/#organization"}},{"articleSection":"Excel","headline":"How to Import SQL Database Data into Excel File [Example]","description":"In this tutorial, we are going to import data from a SQL external database. This exercise assumes you have a working instance of SQL Server and basics of SQL Server. First we create SQL file to import","keywords":"excel","speakable":{"@type":"SpeakableSpecification","cssSelector":[".entry-title",".summary"]},"@type":"Article","author":{"@id":"https://www.guru99.com/author/charlotte","name":"Charlotte Miller"},"dateModified":"2026-07-15T13:25:27+05:30","image":{"@id":"https://www.guru99.com/images/how-to-import-sql-database-into-excel.png"},"copyrightYear":"2026","name":"How to Import SQL Database Data into Excel File [Example]","subjectOf":[{"@type":"FAQPage","mainEntity":[{"@type":"Question","name":"What is the difference between Windows and SQL Server authentication?","acceptedAnswer":{"@type":"Answer","text":"Windows authentication signs in with the current Windows account, so no password is typed, which suits a local server. SQL Server authentication needs a separate user id and password, and is used for remote servers."}},{"@type":"Question","name":"Does the Excel table update when the database changes?","acceptedAnswer":{"@type":"Answer","text":"Only after a refresh. The imported table keeps a connection but does not update on its own. Click Refresh on the DATA tab, or set the connection to refresh when the file opens, to see the newest rows."}},{"@type":"Question","name":"Can I import the result of a SQL query instead of a whole table?","acceptedAnswer":{"@type":"Answer","text":"Yes. In the connection properties, change the command type to SQL and paste a SELECT statement. Excel then imports only the rows and columns that the query returns, which is faster for a large table."}},{"@type":"Question","name":"Can AI write the SQL query for an Excel import?","acceptedAnswer":{"@type":"Answer","text":"Yes. AI features such as Copilot turn a plain request like employees in Sales earning over 2000 into a SELECT statement. The user reviews the query and pastes it into the connection before importing."}},{"@type":"Question","name":"Can AI analyse the data after it is imported from SQL?","acceptedAnswer":{"@type":"Answer","text":"Yes. AI assistants summarise the imported table, build a pivot or chart, and answer questions about it in plain language. The live connection means a refresh keeps the analysis current with the database."}}]}],"@id":"https://www.guru99.com/import-sql-data-excel.html#schema-1144743","isPartOf":{"@id":"https://www.guru99.com/import-sql-data-excel.html#webpage"},"publisher":{"@id":"https://www.guru99.com/#organization"},"inLanguage":"en-US","mainEntityOfPage":{"@id":"https://www.guru99.com/import-sql-data-excel.html#webpage"}}]}
```
