PhpSpreadsheet: Fatal error while using Writer\xlsx

Hi I have an error, help me please… What is the problem please ?

What is the expected behavior?

I want to create a XLSX file

Code ?

<?php
require 'phptoexcel/vendor/autoload.php';

use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;

$spreadsheet = new Spreadsheet();
$sheet = $spreadsheet->getActiveSheet();
$sheet->setCellValue('A1', 'Hello World !');

$writer = new Xlsx($spreadsheet);
$writer->save('hello world.xlsx');

What is the current behavior?

There is fatal error : ( ! ) Fatal error: Class ‘PhpOffice\PhpSpreadsheet\Writer\Xlsx’ not found in C:\wamp64\www\timax\test.php on line 12

Which versions of PhpSpreadsheet and PHP are affected?

Last version with PHP 7

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 16 (9 by maintainers)

Most upvoted comments

I am closing this, because it is not a bug within PhpSpreadsheet but a support question about usage. But feel free to keep the discussion going…

Have you download the phpSpreadsheet? Have you execute “composer install” command? Are ‘phptoexcel’ is the correct folder of phpSpreadsheet?