genderwatchprotocol/spreadSheetReader/read_write_xlsx.php

19 lines
509 B
PHP
Raw Normal View History

2023-02-14 19:56:51 +01:00
<?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) {
2023-02-14 23:20:53 +01:00
$xlsx = SimpleXLSXGen::fromArray($data);
2023-02-14 19:56:51 +01:00
$xlsx->saveAs($filename);
}