tariqahsan has asked for the wisdom of the Perl Monks concerning the following question:

Is there a way to enforce password protection
creating a MS Excel spreadsheet using like Spreadsheet.pm?

Thanks in advance for any suggestion.

  • Comment on Password protection creating an Excel spreadsheet

Replies are listed 'Best First'.
Re: Password protection creating an Excel spreadsheet
by marto (Cardinal) on Jan 10, 2006 at 16:55 UTC
    Hi tariqahsan

    The Spreadsheet::WriteExcel module has the protect() method which can be used to apply a password for worksheet protection:

    $worksheet->protect('mysillypassword');.

    N.B. From the the documentation:

    "Note, the worksheet level password in Excel provides very weak protection. It does not encrypt your data in any way and it is very easy to deactivate. Therefore, do not use the above method if you wish to protect sensitive data or calculations. However, before you get worried, Excel's own workbook level password protection does provide strong encryption in Excel 97+. For technical reasons this will never be supported by Spreadsheet::WriteExcel."

    Have a look at the documentation to see if it suits your other requirements.

    Hope this helps.

    Martin
      Thanks! Martin. I will try out the
      $worksheet->protect('mysillypassword');

      Tariq

      Hi Martin, I have created a excel sheet which contains 6 worksheets, 1: Contains data 2 - 6: Charts created using add_chart Here I dodnt have a handle for chart worksheet. How to protect all the 6 sheets ?

        Since this thread has been resurrected, it's probably worth putting in a pointer to a node I wrote in a similar, later thread: Re^4: Password Protect Excel File. Excel's internal protection is like a knee high fence. It's no more than a polite warning to the law abiding. Files can be properly secured so that they cannot be opened without the password, but sheet and project level protection is extremely weak and can be bypassed trivially. The link provided does not cover project level protection, but JFGI.

        Regards,

        John Davies