Solved

importing data into access by excel

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi XE10 Round Image 2 121
Create a path if not exists 7 76
CheckListBox usage 3 58
how to change, disabled button color FMX ? 1 32
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

785 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