Export password protected Excel file and encrypt Excel file using EasyXLS library! XLS, XLSX, XLSM, XLSB file in PHP.
https://www.easyxls.com/manual/tutorials/php/encrypt-excel-file.html