473,387 Members | 1,561 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

import data from excel sheet to ms access database

hi

I want to import data from excel sheet to ms access database in asp.

sample code if possible

regards ela...
Oct 24 '07 #1
4 4708
hi all,

i downloaded the excel file..... when i am trying to export the excel file to access database i getting the error External table is not in the expected format.

if i select the excel file and copy to another excel file... than export.. it is working...

to download the excel file the code i written was
Expand|Select|Wrap|Line Numbers
  1. <% 
  2. dim Cn,Rs
  3. set Cn=server.createobject("ADODB.connection")
  4. set Rs=server.createobject("ADODB.recordset")
  5. Cn.open "provider=microsoft.jet.oledb.4.0;data source=" & server.mappath("db1.mdb")
  6. Rs.open "select * from sendsms",Cn,1,3
  7. Response.ContentType = "application/vnd.ms-excel"
  8. Response.AddHeader "Content-Disposition", "attachment; filename=Enquiry_List.xls" 
  9. if Rs.eof <> true then
  10. response.write "<table border=1>"
  11. while not Rs.eof
  12.  
  13. response.write "<tr><td>" & Rs.fields("msg") & "</td><td>" & Rs.fields("sender") & "</td></tr>"
  14.  
  15. Rs.movenext
  16. wend
  17. response.write "</table>"
  18. end if
  19. set rs=nothing
  20. Cn.close
  21. %>
regards
ela
Oct 24 '07 #2
jhardman
3,406 Expert 2GB
please don't double-post. if necessary, you may pm another member asking him or her to look at your question.

Jared
Oct 25 '07 #3
ejuly
2
Because the method that you use to export data to excel file is in HTML format, so you cannot read the excel file in your Import module. You have to find a way to export your data as a "TEXT" but not "HTML".

Good Luck!
Jan 18 '08 #4
ejuly
2
Hi,

you may get the idea from my blog site.

http://july-code.blogspot.com/2008/01/export-data-to-excel-not-html-tables.html

Good Luck!
Jan 21 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Steve Jorgensen | last post by:
I'm restarting this thread with a different focus. The project I'm working on now id coming along and will be made to work, and it's too late to start over with a new strategy. Still, I'm not...
3
by: Mads Petersen | last post by:
I'm stuck in this code. Hope you can and will help me. I launch it from excel. I have made the following code work, but not as i whant. I need the ranges to be working with something like xlDown....
15
by: daniroy | last post by:
Hello everybody, your help will be very very welcome on a very classic question... I have some Excell Macro background, a little bit of VBA knowledge. I import daily from Internet series of...
11
by: Hi5 | last post by:
Hi, I am new to access I usedto work in Oracle and Mysql. I am after a way that enables me to populate a database I designed in access with lots of data which can be sorted in excel sheets, ...
8
by: Nick M | last post by:
Hello All, Excellent info here Thanks! I am very new to using access in general and I am on a learning curve. I'm trying to import an excel workbook (with worksheets) into an access db via a...
10
by: Niklas | last post by:
Hi Before I start coding I need to be sure that nobody else has not done it yet and that I can use it. I need an import utility which import data from Excel to a database or some object in...
2
by: madeleine | last post by:
I'm hoping the answer to this is that I'm just doing something silly, but I'm really scratching my head over this one. I'm importing data from multiple workbooks, each workbook has a sheet called...
3
by: Kbalz | last post by:
Hello, I'm trying to create an application for a friend's business. He gets Excel Spreadsheets from a lab - he would like for his partners to be able to Upload this Sheet to a website, and have the...
1
by: baling | last post by:
Hi.... Hi everybody, i have a code that i make in VBA and know I want to use this code in to VB6. But i don't know how to use that code in to VB 6.0 Please correct this code so i can use it in VB...
0
by: satenova | last post by:
Hello Friends, I am newbie when it comes to vb.net and i need to import excel sheet into access db using vb.net application. Here is the code i use for now to upload excel sheet and it works...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.