Update an existing Excel file using ASP - Urgent

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Aspgm
    New Member
    • Mar 2007
    • 3

    Update an existing Excel file using ASP - Urgent

    Hi Everyone,

    I have an Excel file to update on-line using ASP. I could write data to a fresh excel file. But I couldn't find a way to open an existing Excel file and update relevant cells. If any one know a clue about this Pl. give me a hint.
  • sani723
    New Member
    • Feb 2007
    • 117

    #2
    Check this, may be helpful 4 u http://www.dotnetspider.com/qa/Question534.aspx

    Comment

    • Aspgm
      New Member
      • Mar 2007
      • 3

      #3
      Dear Sani
      Thank U for prompt reply. But I am looking for a solution for ASP and not for ASP.NET.

      Comment

      • sani723
        New Member
        • Feb 2007
        • 117

        #4
        then this can help you http://support.microsoft.com/default.aspx/kb/195951

        Comment

        • sani723
          New Member
          • Feb 2007
          • 117

          #5
          Or this http://www.15seconds.com/issue/991021.htm

          Comment

          • jhardman
            Recognized Expert Specialist
            • Jan 2007
            • 3405

            #6
            Originally posted by Aspgm
            Dear Sani
            Thank U for prompt reply. But I am looking for a solution for ASP and not for ASP.NET.
            I do this all the time using ado; there is an excel db driver. This requires that the worksheet you update is set up as a db (the other sheets can be in any format you want). Here is an example I worked up and posted several weeks ago. It updates data in a worksheet called "data" in a file called "graphAspTest.x ls" then redirects the user to the excel file. Let me know if it helps.
            Code:
            <% option explicit %>
            <!-- #include virtual="common/adovbs.inc" -->
            <%
            dim objConn, objRS, query, file, names(5), hours(5), i
            
            names(0) = "George"
            names(1) = "Freeda"
            names(2) = "Hercules"
            names(3) = "Agatha"
            names(4) = "Francois"
            hours(0) = 17
            hours(1) = 25
            hours(2) = 40
            hours(3) = 12
            hours(4) = 36
            
            file = "graphAspTest.xls"
            set objConn = server.createobject("ADODB.connection")
            objConn.open "Provider = Microsoft.Jet.OLEDB.4.0;Data Source="&_
               server.mapPath(File)&"; Extended Properties=Excel 8.0;"
            
            query = "SELECT * FROM [data$]"
            query = query & " ORDER BY nums"
            set objRS = server.createobject("adodb.recordset")
            objRS.open query, objConn, adopenDynamic, adlockOptimistic
            
            for i = 0 to 4
               objRS("names") = names(i)
               objRS("hoursWorked") = hours(i)
               objRS.update
               objRS.movenext
            next
            
            objRS.close
            objConn.close
            response.redirect "graphAspTest.xls"
            %>
            Jared

            Comment

            Working...