Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 71
  • Last Modified:

Delphi Excel connection

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
Nicholasjf
Asked:
Nicholasjf
  • 2
2 Solutions
 
Geert GruwezOracle dbaCommented:
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
 
xtermieCommented:
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
 
xtermieCommented:
Good comments and suggestions made but no author ferdback
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now