1

Is there a way to download a spreadsheet that is password protected? I found libraries such as PHPExel but they do not work. Is there any other alternative?

if(isset($_POST["export_excel"]))
{
    $sql = "SELECT * FROM Datas ORDER BY ID DESC";
    $result = mysqli_query($connect, $sql);
    ....
    ....
    ....
    $output .= '</table>';
        header("Content-Type: application/xls");
        header("Content-Disposition: attachment; 
        filename= DB".date('Y_m_d').".xls");
        echo $output;
}
  • Do you mean you want to password protect the spreadsheet the user downloads? – Nigel Ren Jun 11 '20 at 08:46
  • @NigelRen yes exactly –  Jun 11 '20 at 08:51
  • I've looked at various answers, which all seem to indicate that password protection is either to stop users changing the data or just not supported. You may be able to protect it using a zip file - https://stackoverflow.com/a/47589645/1213708 – Nigel Ren Jun 11 '20 at 08:57

0 Answers0