Excel and MDB - Posted (1411 Views)
Average Member
kolucoms6
Posts: 845
845

I am looking for ASP Code to Upload Excel/Tab/CSV file to MDB db.
Now catch is header in Excel/Tab/CSV are not fixed and everytime I get file, it changes.
I am looking for ASP code which will allow me to match fields of Excel/Tab/CSV with MDB and then click on submit and it will upload data to MDB.
Any available ?<
 Sort direction, for dates DESC means newest first  
 Page size 
Posted
Advanced Member
Carefree
Posts: 4224
4224
If you have Access, simply open it and import from the spreadsheet. Otherwise, to do it from a webpage, I'll have to do some digging. I think I have something that'll do it, but no clue where I stashed it.<
Posted
Average Member
kolucoms6
Posts: 845
845
Here is the sample which i am looking at :

http://prodsurvey.webng.com/custom.JPG

I hope it helps in understanding.
Left hand side shows Database field and right side shows Field from excel which I can select.
I can do the mapping and submit data and it will upload all data<
Posted
Advanced Member
Carefree
Posts: 4224
4224
This may help:

Edit: code deleted, faulty. See below.
Save it as "import.asp" and give it a try.<
Posted
Average Member
kolucoms6
Posts: 845
845
I will give it a try but any way i can select Excel from the Local Harddisk ?
I have the same in PHP but need it in ASP.<
Posted
Advanced Member
Carefree
Posts: 4224
4224
Is the Access DB stored remotely and the Excel spreadsheet stored locally? I don't think that's possible, someone else may know differently. I changed the variables in the code to match your example. You cannot use spaces in the field names, change them to underscores.<
Posted
Advanced Member
Carefree
Posts: 4224
4224
Posted
Advanced Member
Carefree
Posts: 4224
4224
One other issue you may encounter is related to differing iusr_(machinename) accounts and passwords. You may have to add a specific username/pw (with a DSN name) that match on both systems. I think it'll be more trouble than it's worth. You may be better off adding a FTP account to the server (with known path), uploading your spreadsheets and using the direct path method.<
Posted
Average Member
kolucoms6
Posts: 845
845
I need to give this Option to my user.<
Posted
Average Member
kolucoms6
Posts: 845
845
Its like :

1) Read all fields from a Table( can be hardcoded in the asp code ) and display on the left side. 2) Read all headers/first row from Excel and fill it in an array. 3) On left side column, Next to each field name form table, display a dropdown box with each excel first row value. 4) On submission of the form, code upload data in respective selected fields.

<
You Must enter a message