28 lines
660 B
PHP
28 lines
660 B
PHP
<?php
|
|
require $_SERVER['DOCUMENT_ROOT'] . '/spreadSheetReader/SimpleXLSX.php';
|
|
require $_SERVER['DOCUMENT_ROOT'] . '/spreadSheetReader/SimpleXLSXGen.php';
|
|
function read_xls_file($filename){
|
|
$fileContent = [];
|
|
if ($xlsx = SimpleXLSX::parse($filename)) {
|
|
$fileContent = ($xlsx->rows());
|
|
} else {
|
|
echo SimpleXLSX::parseError();
|
|
}
|
|
return $fileContent;
|
|
}
|
|
|
|
|
|
|
|
function write_xlsxFile($filename, $data) {
|
|
|
|
foreach ($data as $row) {
|
|
echo "new Row: <br>";
|
|
foreach ($row as $cell) {
|
|
echo $cell." ";
|
|
}
|
|
}
|
|
|
|
|
|
$xlsx = \Shuchkin\SimpleXLSXGen::fromArray($data);
|
|
$xlsx->saveAs($filename);
|
|
} |