Solved

importing data into access by excel

Posted on 2006-10-23
5
326 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 25

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
oracle global variables 4 63
How to debug For loops? 3 46
Find and Replace Stream with 0s 8 57
how to change, disabled button color FMX ? 1 16
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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

867 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

20 Experts available now in Live!

Get 1:1 Help Now