-1

Can anyone point me to an example for exporting an excel table into an sql table, assuming the same structure, using VBA? I'm using Excel 2007. I've seen examples that read the data one row at a time and either run one insert per row, or build their recordset, and do UpdateBatch. Is there a way where I can select all record from the source table in excel and insert them all into the target sql table?

Lukasz
  • 557
  • 2
  • 13
  • 27
  • 1
    [Google says](https://www.google.com/search?q=import+excel+to+sql&ie=utf-8&oe=utf-8) not a very good question. [How to ask a good question](http://stackoverflow.com/help/how-to-ask) – FreeMan Mar 30 '15 at 21:06

1 Answers1

0

Bulk Insert is what you are looking for.

Try these: Stackoverflow question

Bulk Insert - social msdn

Other way is to import in sql management studio Import Excel spreadsheet columns into SQL Server database

Community
  • 1
  • 1
durbo
  • 556
  • 4
  • 11
  • Thanks, but I can't seem to find an example for using bulk insert from the Excel workbook itself (using VBA). – Lukasz Mar 31 '15 at 15:08
  • You write the sql bulk insert and connection string in your VBA program.The easiest way I've found is to import the excel or txt file from sql management – durbo Apr 04 '15 at 04:25