Results 1 to 5 of 5

Thread: Excel from VBScript

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Posts
    142
    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
    Secret to long life:
    Keep breathing as long as possible.

  2. #2
    Lively Member
    Join Date
    Jul 2000
    Posts
    104
    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

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Posts
    142
    thanks. will check that out!

    dvst8
    Secret to long life:
    Keep breathing as long as possible.

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Posts
    142
    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
    Secret to long life:
    Keep breathing as long as possible.

  5. #5
    Hyperactive Member
    Join Date
    May 2000
    Location
    Or
    Posts
    316
    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:

    Code:
    Dim objxl, objbk, objsh
    
    
    
    Set objxl=CreateObject("Excel.Application")
    Set objbK = objXL.Workbooks.Open("c:\somedirectory\somefile.xls")
    Set objsh = objbK.ActiveSheet
    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.

    Hope this is helpful.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width