Jump to content

excel import işlemi nasıl yapılır?


mehmet07

Recommended Posts

Merhabalar,

Excel'den verileri okumak istiyorum.

 

 

  AStream: TFileStream);
var
  Excel: Variant;
  WorkSheet : Variant;
  s: string;
begin
  try
  try
    Excel := CreateOleObject('Excel.Application');
    Excel.Visible := False;
    Excel.Workbooks.Open(AStream.FileName);
    memo.Lines.Add('File loaded');
    WorkSheet := Excel.Workbooks[1].WorkSheets[1];
    s := WorkSheet.Cells[1, 1];
    memo.Lines.Add(Format('[1,1]="%s"', [s]));
  except
    on E: Exception do memo.Lines.Add('Error in Excel: ' + E.Message);
  end;
  finally
    if not VarIsEmpty(Excel) then Excel.Quit;
  end;

Bunun için yukarıdaki kod'u kullandım. Normalde sıkıntısız çalışıyor. Ama Dll olarak çalıştırınca 

 Erişim engellendi, ProgID: "Excel.Application"

 

 

Hatasını alıyorum.

Excel'den verileri nasıl okuyabilirim acaba?

 

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...