1 (edited by v_pozidis 2019-03-27 09:38:00)

Topic: Help insert execl file and Open File Dialog to select file

Hi to all. I need help in my attached software. I like to insert an excel file pressing the Insert Xls button. The file contains a part of the database (Barcode, Amount, day).  Inserting the file I like to get all the details from the customer (barcode , Lastname, Name , Address)  in the tablegrid.
giving only the barcode.  It should find the customers automatically..  and how can I get an Open File Dialog  to select the excel file?
Thank you in advacne.

Post's attachments

Attachment icon Desktop.zip 348.62 kb, 286 downloads since 2019-03-27 

Re: Help insert execl file and Open File Dialog to select file

Hello.


You want to import data from the excel file to a database? or just show data from the excel file on a TableGrid?



How to use open file dialog

procedure Form1_Button1_OnClick (Sender: TObject; var Cancel: boolean);
var
  OpenDialog : TOpenDialog;
begin
   OpenDialog := TOpenDialog.Create(Form1);
   IF OpenDialog.execute then
   begin
      ShowMessage(OpenDialog.Filename);
   end;
   OpenDialog.Free;
end;
Dmitry.

3 (edited by v_pozidis 2019-03-28 08:08:24)

Re: Help insert execl file and Open File Dialog to select file

I want to import the excel datas to the database.  In my example I have a excel file with 3 columns (barcode - amount - day). Importing this data in the database when wanna look the tablegrid or search in the tablegrid  I like to get the result  with all the records (barcode - lastname - name - ammount - day)

Re: Help insert execl file and Open File Dialog to select file

Unfortunately I don't have example how to import data directly from Excel. You can save excel file as CSV using Excel, here you can find an example, how to import csv file:
http://myvisualdatabase.com/forum/viewtopic.php?id=1448


Also you can read data from excel directly using script:
http://myvisualdatabase.com/forum/misc. … download=1



Using these examples you can do import from Excel file to database.

Dmitry.