Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Importing xls/xlsx file into SQL

Author  Topic 

vikasbhandari2
Starting Member

1 Post

Posted - 2007-07-07 : 03:46:50
Hi all,

Actually, I am working in a leading advertisement company where we were handling all of our data in Access, but because our database is getting really large, we have to shift to SQL because queries were taking long time to execute. I have no idea what SQL is. However, i have a problem. In access, i had to import an xlsx(excel 2007 file) in my database. In access I used to do this:

Sub SendTableToExcel()
DoCmd.TransferSpreadsheet acImport, _
acSpreadsheetTypeExcel9, "Campaigns", _
"C:\frequentstuffs\Campaigns.xlsx", True
End Sub

The format(ie the col Names and structure) in table Campaign and Excel File, is same. I just need to copy the data from excel into SQL. How can i do the same thing in SQL? To be very precise, I am novice to SQL so if explained in a novice languauge, i would really appreciate it!!

Vikas B

Vikas Bhandari
Visit My Blog
www.excelnoob.blogspot.com

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-07-07 : 04:11:53
Refer this
http://sqlteam.com/forums/topic.asp?TOPIC_ID=49926

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

baash05
Starting Member

1 Post

Posted - 2011-12-20 : 20:00:15
The code provided on that thread is for xls not xlsX.
I have two files one xls and one xlsx, and the code pushes in the xls, but balks at the X.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2011-12-21 : 02:24:24
quote:
Originally posted by baash05

The code provided on that thread is for xls not xlsX.
I have two files one xls and one xlsx, and the code pushes in the xls, but balks at the X.

You need to use JET 12.0 version engine and specify the same in the above code

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -