I found code on how to Read Excel File Data in PHP using PHPExcelReader. It says here that it supports both for xls and xlsx file. However when viewing for xlsx file it says that the file is not readable. It only work when viewing xls file. Is there anything I can add at my code to make it readable for xlsx file too? I've also tried searching for answers in the web but it is still readable. Please help me thank you.
<?php
$filename = "uploads/$filename";
$excel_file = $filename;
$sheet_data = '';
$table_output = array();
$max_rows = 0;
$max_cols = 0;
$force_nobr = 0;
require_once 'excel_reader.php';
$excel = new PhpExcelReader();
$excel->setOutputEncoding('UTF-8');
$excel->read($excel_file);
$nr_sheets = count($excel->sheets);
function make_alpha_from_numbers($number) {
$numeric = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
if($number<strlen($numeric)) return $numeric[$number];
else {
$dev_by = floor($number/strlen($numeric));
return make_alpha_from_numbers($dev_by-1) .
make_alpha_from_numbers($number-($dev_by*strlen($numeric)));
}
}
I think that the reason why you can't read .xslx files is because you don't have the PHP extension 'php_zip' enabled.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With