Create workbookExport.php
This commit is contained in:
parent
d3a49e1b27
commit
1123dc6947
24
server/workbookExport.php
Normal file
24
server/workbookExport.php
Normal file
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
require("vendor/autoload.php");
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||
use PhpOffice\PhpSpreadsheet\Writer\Ods;
|
||||
$spreadsheet = new Spreadsheet();
|
||||
$reader = new \PhpOffice\PhpSpreadsheet\Reader\Csv();
|
||||
|
||||
$reader->setInputEncoding('CP1252');
|
||||
$reader->setDelimiter(',');
|
||||
$reader->setEnclosure('"');
|
||||
$reader->setSheetIndex(0);
|
||||
|
||||
|
||||
$spreadsheet = $reader->load("data/current.csv");
|
||||
$writer = new Xlsx($spreadsheet);
|
||||
$writer->save("data/current.xlsx");
|
||||
|
||||
$writer = new Ods($spreadsheet);
|
||||
$writer->save("data/current.ods");
|
||||
|
||||
$spreadsheet->disconnectWorksheets();
|
||||
unset($spreadsheet);
|
Reference in New Issue
Block a user