Solved

importing data into access by excel

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

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…
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…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

728 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