I have a bunch of excel files (with tables) in a folder that I want to import into SQL Server. Is there a loop or some code that I can write in SQL that will go to file path, open the file and import the data into the table? (I have data for each state so opening 50 tables will be tedious and I am looking to avoid doing so.)
-
1Sql Server Integration Services can do this: Loop through Excel Files and Tables by Using a Foreach Loop Container learn.microsoft.com/en-us/sql/integration-services/control-flow/…David Browne - Microsoft– David Browne - Microsoft2020-01-03 17:50:53 +00:00Commented Jan 3, 2020 at 17:50
-
@DavidBrowne-Microsoft Does the ADO.NET connection manager mentioned in the article need to be installed or is it included in SQL Server?JoeJam– JoeJam2020-01-03 17:59:13 +00:00Commented Jan 3, 2020 at 17:59
-
SSIS is an optional component of most editions of SQL Server. You can get the designer for SSIS with SQL Server Data Tools: learn.microsoft.com/en-us/sql/ssdt/…, which includes everything you need to build and test SSIS packages.David Browne - Microsoft– David Browne - Microsoft2020-01-03 18:01:26 +00:00Commented Jan 3, 2020 at 18:01
-
Is there a way to write the loop with out downloading any software? I am on a company computer and cannot download software.JoeJam– JoeJam2020-01-03 18:03:24 +00:00Commented Jan 3, 2020 at 18:03
-
1Power Query for Excel can do this too. support.office.com/en-us/article/… You would load all 50 workbooks into a single workbook using Power Query in Excel, then load that one to SQL Server.David Browne - Microsoft– David Browne - Microsoft2020-01-03 18:05:25 +00:00Commented Jan 3, 2020 at 18:05
|
Show 1 more comment
1 Answer
You can use Power Query for Excel to combine the workbooks into a single workbook, and then load that into SQL Server.