Import multiple Excel files into SQL Server without SSIS

Описание к видео Import multiple Excel files into SQL Server without SSIS

Import several files into SQL Server without the use of SSIS but using a bit of VBA in Excel.

Note: *Replace the curly brackets {} with the less than and greater than sign after the 'Do While File' part of code or the VBA code will not work*

VBA Code :

Sub CombineExcelFiles()

Dim Folder As String
Dim File As String
Dim Sht As Worksheet

Application.ScreenUpdating = False
Folder = " FolderName /"
File = Dir(Folder & "*.xls*")

Do While File {} ""
Workbooks.Open Filename:=Folder & File, ReadOnly:=True
For Each Sht In ActiveWorkbook.Sheets
Sht.Copy After:=ThisWorkbook.Sheets(1)
Next Sht
Workbooks(File).Close
File = Dir()
Loop

End Sub

Комментарии

Информация по комментариям в разработке