Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Delphi Excel connection

Posted on 2016-08-16
3
Medium Priority
?
68 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
[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
  • 2
3 Comments
 
LVL 38

Accepted Solution

by:
Geert Gruwez earned 1000 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 1000 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

618 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