open_xlsx_get_data_skip_rows.phpt 830 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. --TEST--
  2. Check for vtiful presence
  3. --SKIPIF--
  4. <?php
  5. require __DIR__ . '/include/skipif.inc';
  6. skip_disable_reader();
  7. ?>
  8. --FILE--
  9. <?php
  10. $config = ['path' => './tests'];
  11. $excel = new \Vtiful\Kernel\Excel($config);
  12. $filePath = $excel->fileName('tutorial.xlsx', 'TestSheet1')
  13. ->header(['Item', 'Cost'])
  14. ->data([
  15. ['Item_1', 'Cost_1', 10, 10.9999995],
  16. ['Item_2', 'Cost_2', 10, 10.9999995],
  17. ['Item_3', 'Cost_3', 10, 10.9999995],
  18. ])
  19. ->output();
  20. $data = $excel->openFile('tutorial.xlsx')
  21. ->openSheet()
  22. ->setSkipRows(3)
  23. ->getSheetData();
  24. var_dump($data);
  25. ?>
  26. --CLEAN--
  27. <?php
  28. @unlink(__DIR__ . '/tutorial.xlsx');
  29. ?>
  30. --EXPECT--
  31. array(1) {
  32. [0]=>
  33. array(4) {
  34. [0]=>
  35. string(6) "Item_3"
  36. [1]=>
  37. string(6) "Cost_3"
  38. [2]=>
  39. int(10)
  40. [3]=>
  41. float(10.9999995)
  42. }
  43. }