from root:
apt-get install composer php-cli
from user:
composer require phpoffice/phpspreadsheet
Into myfile.php (example):
require_once('vendor/autoload.php');
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
// Creates New Spreadsheet
$spreadsheet = new Spreadsheet();
// Retrieve the current active worksheet
$sheet = $spreadsheet->getActiveSheet();
// Set the value of cell A1
$sheet->setCellValue('A1', 'Paolo');
// Sets the value of cell B1
$sheet->setCellValue('B1', 'Pizzolongo');
// Write an .xlsx file
$writer = new Xlsx($spreadsheet);
// Save .xlsx file to the current directory
$writer->save('paolo.xlsx');
Recent Comments