Solved

Delphi Excel connection

Posted on 2016-08-16
3
44 Views
Last Modified: 2016-09-10
I have connected Delphi to an Excel workbook usibng Ado. I can see the spreadsheet in Delphi DB Grid. But how in code do I refer to an Excel cell? So in Excel sheet 1 column is F18, and the row is 5, How do I retrieve the value of this cell to use in, say, an edit box?
0
Comment
Question by:Nicholasjf
  • 2
3 Comments
 
LVL 37

Accepted Solution

by:
Geert Gruwez earned 250 total points (awarded by participants)
ID: 41758998
There is a complete manual for delphi and excel on about.com
http://delphi.about.com/od/database/l/aa090903a.htm

getting field info is in page 4
http://delphi.about.com/od/database/l/aa090903d.htm

and editing, modifying is in page 4
http://delphi.about.com/od/database/l/aa090903e.htm

basically you can query an excel spreadsheet using an ado table
and update/edit it via a dbgrid or sql updatestatements
0
 
LVL 18

Assisted Solution

by:xtermie
xtermie earned 250 total points (awarded by participants)
ID: 41765207
like this , for example:

procedure TForm1.HandleData;
var
  Sheet: Variant;
  i: Integer;
begin
  Sheet := XLApp.Workbooks[1].Worksheets['Delphi Data'];
  for i := 1 to 10 do
    Sheet.Cells][i, 1] := i;
end;

Open in new window

0
 
LVL 18

Expert Comment

by:xtermie
ID: 41792472
Good comments and suggestions made but no author ferdback
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…

770 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