You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/relational-databases/import-export/import-data-from-excel-to-sql.md
+18-15Lines changed: 18 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ title: Import Data from Excel to SQL Server or Azure SQL Database
3
3
description: This article describes methods to import data from Excel to SQL Server or Azure SQL Database. Some use a single step, others require an intermediate text file.
4
4
author: rwestMSFT
5
5
ms.author: randolphwest
6
-
ms.date: 05/19/2025
6
+
ms.date: 07/16/2025
7
7
ms.service: sql
8
8
ms.subservice: data-movement
9
9
ms.topic: concept-article
@@ -74,7 +74,7 @@ To start learning how to build SSIS packages, see the tutorial [How to Create an
74
74
> [!IMPORTANT]
75
75
> In [!INCLUDE [ssazure-sqldb](../../includes/ssazure-sqldb.md)], you can't import directly from Excel. You must first [export the data to a text (CSV) file](import-bulk-data-by-using-bulk-insert-or-openrowset-bulk-sql-server.md).
76
76
77
-
The following examples use the JET provider, because the ACE provider included with Office that connects to Excel data sources is intended for interactive client-side use.
77
+
The following examples use the JET provider. The ACE provider included with Office that connects to Excel data sources is intended for interactive client-side use, which can cause unexpected results when used non-interactively.
78
78
79
79
### Distributed queries
80
80
@@ -100,6 +100,7 @@ The following code sample uses `OPENROWSET` to import the data from the Excel `S
@@ -136,21 +138,22 @@ You can also configure a persistent connection from [!INCLUDE [ssnoversion-md](.
136
138
```sql
137
139
USE ImportFromExcel;
138
140
GO
141
+
139
142
SELECT* INTO Data_ls FROM EXCELLINK...[Data$];
140
143
GO
141
144
```
142
145
143
146
You can create a linked server from SQL Server Management Studio (SSMS), or by running the system stored procedure `sp_addlinkedserver`, as shown in the following example.
144
147
145
148
```sql
146
-
DECLARE @RC INT;
147
-
DECLARE @server NVARCHAR(128);
148
-
DECLARE @srvproduct NVARCHAR(128);
149
-
DECLARE @provider NVARCHAR(128);
150
-
DECLARE @datasrc NVARCHAR(4000);
151
-
DECLARE @location NVARCHAR(4000);
152
-
DECLARE @provstr NVARCHAR(4000);
153
-
DECLARE @catalog NVARCHAR(128);
149
+
DECLARE @RC ASINT;
150
+
DECLARE @server ASNVARCHAR(128);
151
+
DECLARE @srvproduct ASNVARCHAR(128);
152
+
DECLARE @provider ASNVARCHAR(128);
153
+
DECLARE @datasrc ASNVARCHAR(4000);
154
+
DECLARE @location ASNVARCHAR(4000);
155
+
DECLARE @provstr ASNVARCHAR(4000);
156
+
DECLARE @catalog ASNVARCHAR(128);
154
157
155
158
-- Set parameter values
156
159
SET @server ='EXCELLINK';
@@ -159,7 +162,9 @@ SET @provider = 'Microsoft.JET.OLEDB.4.0';
0 commit comments