If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > hoe to read an XLS file

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-14-04, 03:13
Riax Riax is offline
Registered User
 
Join Date: Mar 2004
Posts: 16
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
Reply With Quote
  #2 (permalink)  
Old 04-19-04, 00:28
Bullschmidt Bullschmidt is offline
Guru
 
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
Reply With Quote
  #3 (permalink)  
Old 04-19-04, 03:41
Riax Riax is offline
Registered User
 
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
Reply With Quote
  #4 (permalink)  
Old 01-18-05, 04:12
onlymashal@hotm onlymashal@hotm is offline
Registered User
 
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On