How to Export Data from SQL Server to Excel Automatically

There are several ways to export SQL Server data to Excel file. In this article, two ways to export data from SQL Server to Excel are provided to you. You can export data from SQL server to excel automatically with step by step guides.

author icon

Cedric updated on Mar 16, 2022 to MS SQL Database Recovery | How-to Articles

"Hello, I am new to SQL. We use SQL query in SQL 2016 Server. And then we are exporting the output to excel. Could you please guide me on how to make the process automated for exporting data from SQL to Excel. Since I don’t want to do the task manually any longer. "

If you come across the same problem as mentioned above and want to find a way to export SQL Server data to Excel, don't fret. This page covers two possible ways to help you export data from SQL Server automatically.

Two Ways to Export Data from SQL Server to Excel

You can use the SQL Server Import and Export Wizard and Data Connection Wizard in Excel to export data from SQL Server to Excel. See the details below. 

Solution 1. Use the SQL Server Import and Export Wizard

1. Open SQL Server Management Studio and connect to the database. 

2. Go to "Object Explorer", find the server database you want to export to Excel. Right-click on it and choose "Tasks" > "Export Data" to export table data in SQL. Then, the SQL Server Import and Export Wizard welcome window pop up. 

export data from SQL Server to Excel - 2

3. Now, you need to click on the Data source drop-down button to choose the data source you want to copy. Here, select "SQL Server Native Client 11.0". In the Server name drop-down box, select a SQL Server instance. In the Authentication section, choose authentication for the data source connection and from the Database drop-down box, select a database from which data will be copied. After everything is set, press the "Next" button. 

export data from SQL Server to Excel - 3

4. On the "Choose a Destination" window, in the Destination box, choose Microsoft Excel item for exporting data from SQL Server to Excel. Choose the Excel file path and version as you need. Then, click the "Next" button to continue.

export data from SQL Server to Excel - 4

5. On the Specify Table Copy or Query screen, you can choose "Copy data from one or more tables or views". Then, click "Next" to go on.

export data from SQL Server to Excel - 5

6. In the "Select Source Table and Views" window, you can choose one or more tables and views from which you want to export SQL Server data to an Excel. Click the "Preview" button to preview which data will be generated to an Excel file. Click the "Next" button to move on. 

export data from SQL Server to Excel - 6

7. Here, on the "Save and Run Package" window, check the "Run immediately" and click the "Next" button.

export data from SQL Server to Excel - 7

8. On the "Complete" Wizard window, you can check all the settings set during of exporting process. If everything is right, click "Finish" to start exporting SQL database to Excel.

export data from SQL Server to Excel - 8

9. You can view the exporting process in this step. When it completes, click on "Report" drop-down button.

export data from SQL Server to Excel - 9

10. You can choose "Save Report to File..." (including Excel, Notepad) to save the report. Here, you need to choose Excel as the target file format. 

export data from SQL Server to Excel - 10

How to Repair SQL Server Database

SQL Server Management Studio (SSMS) offers the Import and Export Wizard feature to export data from one data source to another data source. Namely, you can apply this function to export SQL to Excel. For exporting SQL Server database to CSV, link to check the details.

Step 1. Close the SQL Service in Task Manager or SQL Server Manager Console.

Step 2. Run EaseUS MS SQL Recovery, click "Browse" (the two dots) or "Search" to choose the location where you saved your corrupted database. Afterward, Click "Repair" to start analyzing the specified database.

select the SQL database file

Step 3. When it has done, choose the files you want to repair and click "Export".

Select the database objects

Step 4. Turn on the SQL service, you can choose to export the repaired files to database to export it as SQL scripts.

export the SQL database objects

Solution 2. Using the Data Connection Wizard in Excel

Another way to export data from SQL Server to Excel file is to use the Data Connection Wizard dialog in Excel.

1. Launch Excel, open an Excel file in which you want to export SQL Server data. On the toolbar, click the "Data" tab > select "From Other Sources" > choose "From SQL Server".

export SQL data to Excel - 1

2. The "Data Connection Wizard" window will pop up. Enter the name of the SQL Server instance from which data need to export. In the "Log on credentials" section, choose "Use Windows Authentication" mode for the data source connection and click the "Next" button.

export SQL data to Excel - 2

3. Choose the database from which the data will be exported. And click the "Next" button to proceed. On the next window, leave everything as it is and press the "Finish" button.

export SQL data to Excel - 3

4. In the Import Data dialog, choose "Table" and "Existing worksheet" as the screenshot shows. Press the "OK" button. After this, the SQL Server data will be exported to Excel file. 

export SQL data to Excel - 4

Was This Page Helpful?

 

EaseUS MS SQL Recovery

  • Restore (.mdf and.ndf) Files
  • Recover Corrupted Objects
  • Fix Database Log Files
TRY IT NOW