Hello,
I'm into the exact same problem the last days. Here's what I have so far:
- After uploading the source data file you can simply open it as a recordset (for txt, csv and mdb at least - i have problems with xls because you need a named range in the worksheet to act as table name). Once you have a recordset it's no big deal writing it out to SQL.
You need to use a different connection string according to the file type that was uploaded.
for example, for txt and csv:
sConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.mappath("\database"

& ";Extended Properties='text;FMT=Delimited'"
'or
sConn = "Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=" & server.mappath("\database"

& ";Extensions=asc,csv,tab,txt;"
sSql = "select * from filename.csv"
So there's no need to read the file yourself with filesystemobjects.
The problem with excel files:
You can open an excel file as a recordset like this:
sConn2 = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & server.mappath("\database\myfile.xls"

& ";Extended Properties='Excel 8.0;HDR=Yes'"
'If is "HDR=Yes" the provider will not include the first row of the selection into the recordset.
'If is "HDR=No", the provider will include the first row of the cell range into the recordset
sSql = "SELECT * FROM myNamedRange"
I found information on this url about reading excel files:
The point different ways to open the excel file, but only thing I could get to work was opening a named range.
Now of course when the excel file is uploaded you don't know what named ranges (if any) are present...
I'm trying to find a way to open a sheet as recordset instead of a named range. If you have any luck, please let me know. Other solution could be to open the excel file first with means of the excel.application object and somehow create a named range for all data on the first sheet. But I didn't find out yet how to code that in ASP.
Greetings