Topic: Automatic Excel Backup without opening excel

Hello there smile .  I need to automatically create an excel backup every time a record is saved in a table.

Requirements sad  :

The backup should include all records in the table.

Excel should not open; the file should save silently.

It should happen automatically when saving, with no extra clicks.

Is this possible using mvd built-in features or scripting?  Any advice would be appreciated.


L.

Re: Automatic Excel Backup without opening excel

Hi Luis,
Before anyone offers to help, I think it's important to clarify
1.  why you need to do this in the first place
2.  why you want a FULL table back-up every time a SINGLE RECORD is created / amended / deleted?  This has the potential to generate a large number of .xls files which will quickly become unmanageable.
3.  how do you want the .xls files to be named.
4.  do you want just the most recent copy to be kept (in which case how do you identify and delete old copies) etc etc.
And these are just questions without even thinking about it!
Derek.

Re: Automatic Excel Backup without opening excel

Excel supports loading data from a CSV file. Is this backup format acceptable?

Визуальное программирование: блог и телеграм-канал.

4 (edited by luisantafe 2025-09-30 00:47:34)

Re: Automatic Excel Backup without opening excel

derek wrote:

Hi Luis,
Before anyone offers to help, I think it's important to clarify
1.  why you need to do this in the first place
2.  why you want a FULL table back-up every time a SINGLE RECORD is created / amended / deleted?  This has the potential to generate a large number of .xls files which will quickly become unmanageable.
3.  how do you want the .xls files to be named.
4.  do you want just the most recent copy to be kept (in which case how do you identify and delete old copies) etc etc.
And these are just questions without even thinking about it!
Derek.


Thanks @derek.

1.  My boss needs a back up.  She is kind of old school and only trust on excel.

2.  She only needs one excel file.

3.  It would be something like QualityInspection.xlsx

4.  Only the most recent copy.  This will replace the old one.

k245 wrote:

Excel supports loading data from a CSV file. Is this backup format acceptable?


@k245

Sure, csv is perfect.


Thank you guys.

Re: Automatic Excel Backup without opening excel

Hi there.  I am still looking for some way to do a backup in a different format, such as excel, csv etc, without any interference (opening excel, notepad etc, saving manually and then close it).  Any thoughts?

Thanks

Re: Automatic Excel Backup without opening excel

Hello luisante
Something like this ?

procedure Form1_CheckBox4_OnClick (Sender: TObject);                      // Sauvegarde au format Html
var SaveDialog : TSaveDialog;
begin
     SaveDialog := TSaveDialog.Create(Form1);
     SaveDialog := TSaveDialog.Create(Form1);
     SaveDialog.Filter := 'Fichier HTML |*.html';
     SaveDialog.DefaultExt := 'txt';
     If SaveDialog.Execute then
     Begin
       Form1.TableGrid1.SaveToTextFile(SaveDialog.FileName);
     end;
end;

procedure Form1_CheckBox5_OnClick (Sender: TObject);                      // Sauvegarde au format csv
var SaveDialog : TSaveDialog;
begin
     SaveDialog := TSaveDialog.Create(Form1);
     SaveDialog := TSaveDialog.Create(Form1);
     SaveDialog.Filter := 'Fichier CSV |*.csv';
     SaveDialog.DefaultExt := 'txt';
     If SaveDialog.Execute then
     Begin
       Form1.TableGrid1.SaveToTextFile(SaveDialog.FileName);
     end;
end;

procedure Form1_CheckBox3_OnClick (Sender: TObject;var Cancel: boolean);   // Sauvegarde au format txt
var SaveDialog : TSaveDialog;
begin
     SaveDialog := TSaveDialog.Create(Form1);
     SaveDialog.Filter := 'Fichier TXT |*.txt';
     SaveDialog.DefaultExt := 'txt';
     If SaveDialog.Execute then
     Begin
       Form1.TableGrid1.SaveToTextFile(SaveDialog.FileName);
     end;

JB

Re: Automatic Excel Backup without opening excel

Thank you Jean, It works perfect!!!!!!!! 

jean.brezhonek wrote:

Hello luisante
Something like this ?

procedure Form1_CheckBox4_OnClick (Sender: TObject);                      // Sauvegarde au format Html
var SaveDialog : TSaveDialog;
begin
     SaveDialog := TSaveDialog.Create(Form1);
     SaveDialog := TSaveDialog.Create(Form1);
     SaveDialog.Filter := 'Fichier HTML |*.html';
     SaveDialog.DefaultExt := 'txt';
     If SaveDialog.Execute then
     Begin
       Form1.TableGrid1.SaveToTextFile(SaveDialog.FileName);
     end;
end;

procedure Form1_CheckBox5_OnClick (Sender: TObject);                      // Sauvegarde au format csv
var SaveDialog : TSaveDialog;
begin
     SaveDialog := TSaveDialog.Create(Form1);
     SaveDialog := TSaveDialog.Create(Form1);
     SaveDialog.Filter := 'Fichier CSV |*.csv';
     SaveDialog.DefaultExt := 'txt';
     If SaveDialog.Execute then
     Begin
       Form1.TableGrid1.SaveToTextFile(SaveDialog.FileName);
     end;
end;

procedure Form1_CheckBox3_OnClick (Sender: TObject;var Cancel: boolean);   // Sauvegarde au format txt
var SaveDialog : TSaveDialog;
begin
     SaveDialog := TSaveDialog.Create(Form1);
     SaveDialog.Filter := 'Fichier TXT |*.txt';
     SaveDialog.DefaultExt := 'txt';
     If SaveDialog.Execute then
     Begin
       Form1.TableGrid1.SaveToTextFile(SaveDialog.FileName);
     end;

JB