4

I have a ETL job that creates the excel file and puts into one of the unix directory.

I have an unix "mailx -s" command to send that excel as an attachemnt.

I am looking for a way to extend my program or script to make the Excel file write protected before sending it in mail. The program/script should run on Linux/Unix ?

Is there any way.. Please suggest.

Arya
  • 316
  • 1
    The best than can be done, is to cryptographicly sign a file. That way you can know if it changes. There may be snake-oil programs that can do this in MS-Windows, by setting a please don't edit this file bit. – ctrl-alt-delor Jul 08 '19 at 16:40

1 Answers1

3

I'm sorry to say, when you send a file by email, you strip away the metadata which would enable read-only status of the file itself.

An alternative approach using the Perl module Excel::Writer::XLSX to make the XLS or XLSX file 'Protected' will not modify an existing XLS or XLSX file, and learning Perl to generate the XLSX file instead of the existing ETL process is a non-trivial task which may be too much to ask.

That leaves creating a macro in LibreOffice or OpenOffice to open the file, protect it, and close it.

K7AAY
  • 3,816
  • 4
  • 23
  • 39
  • 1
    Thanks a lot for the reply. I have file available in linux. But before sending an email i want to change the property. Is there any way.. – Arya Jul 08 '19 at 16:32
  • I have perl installed in my system. – Arya Jul 08 '19 at 16:35
  • 2
    But the Perl module will not modify an existing XLS or XLSX file. You can't use Perl's Excel::Writer::XLSX module to do what you want unless you change your ETL process. I mentioned it only because a search would show it. Therefore, see the third paragraph of my answer above. – K7AAY Jul 08 '19 at 16:37