Import multiple Excel files into SQL Server without SSIS

preview_player
Показать описание
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
Рекомендации по теме
Комментарии
Автор

This is what I was looking for but my files are large hence I cannot combine it.

Could you please let me know how to upload multiple files into sql server table?

swapnilwankhede
Автор

Hello, I'm getting error in this line how to solve this?

voiceofpallavi
join shbcf.ru