?
Solved

importing data into access by excel

Posted on 2006-10-23
5
Medium Priority
?
344 Views
Last Modified: 2010-04-05
I want to import Excel sheet data into access database using delphi programming
is there any proper way to do so
0
Comment
Question by:Asmitagoyal
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 17

Accepted Solution

by:
Wim ten Brink earned 672 total points
ID: 17787383
There are several techniques to do so but the simplest way are by either using ADO or by using the Excel type library. With ADO, all you have to do is connect to your Excel sheet as if it's a datasource. (It will have it's own drivers in ADO.) The pages will appear as tables, with columns as fieldnames and rows as record. This would give you complete access to the contents of the Excel sheet.

Of course, with OLE automation you can also do quite a few things with your Excel sheet. But this is more for creating Excel sheets and working with formula's than just reading the contents.

As an alternative option, you could save your Excel sheets as XML files with the newest Office versions. Then by using an XSLT file (XML Stylesheet) you could convert the file to another XML format for easier processing in your application. Or you'd read the XML directly. But this does require you to save the sheets in XML format.

Since you have to move from Excel to Access I would suggest the first option, though. Create one ADO connection with the Excel sheet and a second connection with the Access database. Then do a Batchmove or whatever.
I think you can even do this within Access without the need of Delphi! I just don't know how, exactly, although the principle is basically the same, relying on the ADO functions for accessing and copying data.
0
 
LVL 25

Assisted Solution

by:Tomas Helgi Johannsson
Tomas Helgi Johannsson earned 664 total points
ID: 17788257
    Hi!

You can use a component called Advanced Data Import : http://www.torry.net/pages.php?id=555
Or modify/use this code here : http://www.swissdelphicenter.ch/torry/showcode.php?id=1728
to import the data to a StringGrid and then to a DB table.
And if I remember it correctly there is an MemoryTable component that can open an Excel file directly
and you can access the data in the cells as any other fields in a dataset.

Regards,
  Tomas Helgi
0
 
LVL 11

Assisted Solution

by:calinutz
calinutz earned 664 total points
ID: 17793938
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses
Course of the Month14 days, 15 hours left to enroll

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question