insert excel template

 avatar
user_1913875940
php
3 years ago
991 B
5
Indexable
<?php


$inputFileName = __DIR__ . DIRECTORY_SEPARATOR . "LHKS_anak_timbang.xls";
$inputFileType = \PhpOffice\PhpSpreadsheet\IOFactory::identify($inputFileName);
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
$spreadsheet = $reader->load($inputFileName);
$Excel_writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, $inputFileType);
$spreadsheet->setActiveSheetIndex(0);
$activeSheet = $spreadsheet->getActiveSheet();
$filename = 'data_pengiriman';
$startNum = 5;
$num = $startNum;
$no = 1;
// exp: write text to cell
$activeSheet->SetCellValue('A6', 'Kepada Yth :   Manager Keuangan Cabang ' );


// if you want to download this report
// header('Content-Type: application/vnd.ms-excel');
// header('Content-Disposition: attachment;filename="' . $filename . '.'. $inputFileType .'"');
// header('Cache-Control: max-age=0');
// $Excel_writer->save('php://output');

$Excel_writer->save(__DIR__.DIRECTORY_SEPARATOR."output.".$inputFileType );
Editor is loading...