Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2004
    Posts
    16

    Unanswered: hoe to read an XLS file

    hi,
    i want to read the contents of an xls file and further write those to an access db.but i got a problem reading the file,it doesn't work with
    FileSystemObject 's reading file, like f.ReadAll and..

    what's the problem with it & what the solution..
    any help will be appriciated.

    thanks in advance.
    riax

  2. #2
    Join Date
    Jun 2003
    Location
    USA
    Posts
    1,032
    Well to manually import data from a CSV file into a database such as Access you could get into the database, import the file into a new table, and then run an append query.

    If everything is online then let the CSV file be a recordset that you go through record by record to read and let the regular database table be a recordset to go through record by record to write. You could delete all the related records in the regular database first and then add them all back one by one.

    Using Excel Spreadsheets as Web Data Sources by Steven B. Raines
    http://algonquinstudios.com/articles/excel_db.asp
    J. Paul Schmidt, Freelance Web and Database Developer
    www.Bullschmidt.com
    Access Database Sample, Web Database Sample, ASP Design Tips

  3. #3
    Join Date
    Mar 2004
    Posts
    16
    thanks guru,for u r advice.
    m presently doing the same thing but the excel sheet need to be checked and cleaned before entering to the database,thats a bit boring thing to do.trying to manipulate through code.

    thanks once again.
    riax

  4. #4
    Join Date
    Jan 2005
    Posts
    1
    Quote Originally Posted by Riax
    hi,
    i want to read the contents of an xls file and further write those to an access db.but i got a problem reading the file,it doesn't work with
    FileSystemObject 's reading file, like f.ReadAll and..

    what's the problem with it & what the solution..
    any help will be appriciated.

    thanks in advance.
    riax
    u dont need to use FileSystemObject
    treat xls file as a db file and use the following connection string

    set objConn = Server.CreateObject("ADODB.Connection")
    objConn.Open "DBQ=" & Server.MapPath(".") & "\your_file.xls;DefaultDir=" & Server.MapPath(".") & ";Driver={Microsoft Excel Driver (*.xls)};DriverId=790;FIL=excel 8.0;MaxBufferSize=2048;MaxScanRows=8;PageTimeout=5 ;ReadOnly=0;SafeTransactions=0;Threads=3;UID=admin ;UserCommitSync=Yes;"

    Regards,
    Mashal

Posting Permissions

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