Solved

importing data into access by excel

Posted on 2006-10-23
5
323 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
5 Comments
 
LVL 17

Accepted Solution

by:
Wim ten Brink earned 168 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 24

Assisted Solution

by:Tomas Helgi Johannsson
Tomas Helgi Johannsson earned 166 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 166 total points
ID: 17793938
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

705 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now