1. File more, you need to import so much data into the DB, a import is too slow, can think of the first data into an Excel, and then import
2. The first step is to prepare to merge Excel, create a new Excel, named Totaldata.xlsx, remember that the excel2016 version does not support xlsx import, only the XLS selection, so the above suffix name unified to. xls
3. Double hit Open totaldata.xlsx,alt+f11, quickly open the editor, double-click "Sheet1", enter the following script
Sub Workbook sheet merge () Dim Fileopendim X as integerapplication.screenupdating=Falsefileopen= Application.getopenfilename (filefilter:="Microsoft Excel Files (*.xls), *.xls", Multiselect:=true, title:="Merge Workbook name") X=1While X<=UBound (FileOpen) workbooks.open Filename:=FileOpen (X) Sheets (). Move after:=thisworkbook.sheets (ThisWorkbook.Sheets.Count) X= X +1WendExitHandler:Application.ScreenUpdating=trueexit suberrhadler:msgbox err.descriptionend Sub
4. Run the sub-process/UserForm, select multiple Excel to merge , click OK, and you can see that the files are integrated into one Excel
5. Check the data, Ctrl+s save
6. Import data into Sqlserverdb, open Data, link, select the DB point that will be data to, right-click->tasks->importdata--->next
7. Select the data source, here is the Excel file select "Microsoft Excel", if it is notepad. txt, select Flat File source, other depending on the situation,
Click Browse ... Select the imported file, Totaldata.xlsx, and then Next
8. Choose the mode of login, link the way servername general "." Local link, then next
9. Default next-> default next->
10.next-> is done by default!
Multiple Excel files are quickly imported into the DB