Read/Update an existing Excel Spreadsheet

Results 1 to 7 of 7

Thread: Read/Update an existing Excel Spreadsheet

  1. #1
    Attila Toke Guest

    Default Read/Update an existing Excel Spreadsheet

    I see plenty of article on how to write a Excel spread sheet, but that is NOT what I need. I need to know how to open an existing spreadsheet and update values from my ASP application..<BR><BR>Someone please help!!!!!!!!!!<BR><BR>Attila

  2. #2
    LeeAnnie Guest

    Default Got the answer from the horses mouth...

    Have you tried going to the people who wrote ASP and Excel?<BR><BR><BR><BR><BR>Hope this helps. :o)

  3. #3
    Attila Toke Guest

    Default RE: Got the answer from the horses mouth...

    I found that!! But Now I am getting this error, Can you help??<BR>Here is the code:<BR> Set objConn = Server.CreateObject("ADODB.Connection")<BR>&#039 objConn.Open "OSHA200"<BR>&#039 objConn.Open "ADOExcel"<BR>objConn.Open "DBQ=" & Server.MapPath("ADOExcel.xls") & ";" & _<BR> "DRIVER={Microsoft Excel Driver (*.xls)};"<BR><BR> Set objRS = Server.CreateObject("ADODB.Recordset")<BR> objRS.ActiveConnection = objConn<BR> objRS.CursorType = 3 &#039Static cursor.<BR> objRS.LockType = 2 &#039Pessimistic Lock.<BR> objRS.Source = "Select * from rr"<BR> objRS.Open<BR> %&#062;<BR> <BR><BR> &#060;%<BR> Response.Write("Original Data")<BR><BR> &#039Printing out original spreadsheet headings and values.<BR><BR> &#039Note that the first recordset does not have a "value" property<BR> &#039just a "name" property. This will spit out the column headings.<BR><BR> Response.Write("&#060;TABLE&#062;&#060;TR&#062;")< BR> For X = 0 To objRS.Fields.Count - 1<BR> Response.Write("&#060;TD&#062;" & objRS.Fields.Item(X).Name & "&#060;/TD&#062;")<BR> Next<BR> Response.Write("&#060;/TR&#062;")<BR> objRS.MoveFirst<BR><BR> While Not objRS.EOF<BR> Response.Write("&#060;TR&#062;")<BR> For X = 0 To objRS.Fields.Count - 1<BR> Response.write("&#060;TD&#062;" & objRS.Fields.Item(X).Value)<BR> Next<BR> objRS.MoveNext<BR> Response.Write("&#060;/TR&#062;")<BR> Wend<BR> Response.Write("&#060;/TABLE&#062;")<BR><BR> &#039The update is made here<BR><BR> objRS.MoveFirst<BR> objRS.Fields(0).Value = "change"<BR> objRS.Fields(1).Value = "look"<BR> objRS.Fields(2).Value = "30"<BR> objRS.Update<BR><BR><BR>Here is the error:<BR>Original DataColumn1 column2 column3 <BR>rr this 15 <BR>bb test 20 <BR>ee works 25 <BR><BR>Microsoft OLE DB Provider for ODBC Drivers error &#039 80004005&#039 <BR><BR>[Microsoft][ODBC Excel Driver] Operation must use an updateable query. <BR><BR>/temp/temp.asp, line 58 <BR><BR><BR>I gave the code up to line 58..<BR><BR>PLEASE let me know if you see anything!! The only change I made was to make it DSN less..<BR><BR>Thanks in Advance<BR>Attila Toke

  4. #4
    Join Date
    Dec 1969

    Default RE: Got the answer from the horses mouth...

    I would say you do not have write permissions on the directory that the Excel spreadsheet is in

  5. #5
    Attila Toke Guest

    Default RE: Got the answer from the horses mouth...

    I moved the excel spreadsheet to a directory where I have a access database and ran the code from there and get the same thing!!!<BR><BR>Is anyone able to get this to work???<BR>Attila -

  6. #6
    Attila Toke Guest

    Default RE: Got the answer from the horses mouth...

    I got it to work by changing the permissions to "batch Update"!!<BR><BR>I was changing multiple rows!!<BR><BR>Attila Toke -

  7. #7
    Attila Toke Guest

    Default I spoke to soon!!

    It appears I am not gertting any errors, but my Excel file is not being updated on the server.. When it queries it it sees the changes, but when I go into teh excel spreadsheet no updates!!<BR><BR>Man this is driving me crazy!!!!!!!!!<BR><BR>Help<BR>Attila Toke -

Posting Permissions

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