Empty web page, excel file is not created #3449
Replies: 6 comments 1 reply
-
There is no screen output in this script, so it will show a blank page when you run it. |
Beta Was this translation helpful? Give feedback.
-
Hi there. Thanks for the reply.
This is the output: Checking platform requirements for packages in the vendor dir I don't understand where I'm going wrong. |
Beta Was this translation helpful? Give feedback.
-
If the code wasn't running correctly, then you would see a page with errors. That means the library has been installed correctly, otherwise you would see errors like What I don't see in your code is the include/require for the composer autoload |
Beta Was this translation helpful? Give feedback.
-
Sorry Mark, You are right. Here is the complete script `<?php require 'vendor/autoload.php'; use PhpOffice\PhpSpreadsheet\Spreadsheet; $spreadsheet = new Spreadsheet(); $writer = new Xlsx($spreadsheet); I would expect to find the xlsx file in this directory: /var/www/html/test. And instead there is nothing. As you say, I'm not getting any error messages. So, apparently, everything is working out. |
Beta Was this translation helpful? Give feedback.
-
You'd have got some errors running that script if it hadn't been there ;-) Try adding some diagnostic echo outputs to show each step; include a dump of |
Beta Was this translation helpful? Give feedback.
-
I tried to introduce the `<?php require 'vendor/autoload.php'; use PhpOffice\PhpSpreadsheet\Spreadsheet; $spreadsheet = new Spreadsheet(); $writer = new Xlsx($spreadsheet); $dir = getcwd(); $writer->save('/var/www/html/test/hello_world.xlsx'); ?>` As you can see I also tried using an absolute path to save the file, but that didn't work. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone. I'm a beginner.
I have a ubuntu 22.04.2 machine with PHP 8.1.2. I installed Phpspreadsheet with Composer. Apparently without errors and satisfying all dependencies.
I then create a new project in /var/www/html/test. In this directory I have composer.lock composer.json and vendor/ subdirectory.
Always inside test/ I have the file test.php, containing this script:
`<?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');
?>`
When i run the script, i get a blank web page and the excel file is not created.
What am I doing wrong?
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions