I have a web-page running ASP. I want to bring in an excel file, and dissect it (i.e. get all the column headings, and extract all data) to insert the info into a database.
How can I programmatically (in VBSCript) pull out this data?
Thanks.
dvst8
Printable View
I have a web-page running ASP. I want to bring in an excel file, and dissect it (i.e. get all the column headings, and extract all data) to insert the info into a database.
How can I programmatically (in VBSCript) pull out this data?
Thanks.
dvst8
I wouldn't try to load an excel spreadsheet. Try using XML. MSDN has a sample with good code on how to build an XML file from an excel spreadsheet and then it has a server component that does the parsing to drop the data into a db.
Excel to XML code:
http://msdn.microsoft.com/library/techart/fmcorpxml.htm
Server component:
http://msdn.microsoft.com/library/te...corpcmpnts.htm
thanks. will check that out!
dvst8
i looked over this stuff, but i don't think XML is the direction i want to take.
i would prefer to parse the .xls file directly in my ASP code (using VBScript). can this be done? it should be OK if I can access the Excel Object model from vbscript. If so, How?
thanks.
dvst8
If all you need to know is how to access the excel objects in vbscript, you just need to set you variables in the following manor:
And that is it. It is basically the same as regular vb, only you don't have access to Excel's events, and obviously you have to create the objects. If you need more help, just ask.Code:
Dim objxl, objbk, objsh
Set objxl=CreateObject("Excel.Application")
Set objbK = objXL.Workbooks.Open("c:\somedirectory\somefile.xls")
Set objsh = objbK.ActiveSheet
Hope this is helpful.