kura2yamato

003 basic reader

Oct 14th, 2021
661
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. //diletakkan di atas (harus ada)
  3. use PhpOffice\PhpSpreadsheet\IOFactory;
  4.  
  5. /*
  6. letakkan dalam controller..
  7. */
  8. $inputFileType = 'Xls';
  9. $inputFileName = __DIR__ . '/sampleData/example1.xls';
  10.  
  11. $reader = IOFactory::createReader($inputFileType);
  12. $reader->setReadDataOnly(true);
  13. $spreadsheet = $reader->load($inputFileName);
  14. $sheetData = $spreadsheet->getActiveSheet()->toArray(null, true, true, true);
RAW Paste Data