<?php require 'vendor/autoload.php'; $data = array('foo' => '150000197301'); $spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet(); $sheet = $spreadsheet->getSheet(0); $sheet->fromArray($data, null, 'A1'); $sheet->getStyle('A1:A1') ->getNumberFormat() ->setFormatCode(\PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_TEXT); $writer = new \PhpOffice\PhpSpreadsheet\Writer\Xlsx($spreadsheet); $filename = 'test_' . PHP_VERSION . '.xlsx'; $writer->save($filename);
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter