-1

I have loaded everthing as required by php spreadsheet but when I run the code its just silent nothing happening , no errors on anything

Here the the link getReports with the below code https://payme.nouveta.co.ke/api/index.php?function=getReports

require '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');

I just want to to download the sample the I proceed from there . I have used composer to add the vendor files into my project but when I run nothing is happenning

 C:\xampp\htdocs\nouveta\STKPUSH>composer require phpoffice/phpspreadsheet
PHP:  syntax error, unexpected '(' in C:\xampp\php\php.ini on line 1052
Using version ^1.6 for phpoffice/phpspreadsheet
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 4 installs, 0 updates, 0 removals
  - Installing markbaker/matrix (1.1.4): Loading from cache
  - Installing markbaker/complex (1.4.7): Loading from cache
  - Installing psr/simple-cache (1.0.1): Loading from cache
  - Installing phpoffice/phpspreadsheet (1.6.0): Loading from cache
phpoffice/phpspreadsheet suggests installing mpdf/mpdf (Option for rendering PDF with PDF Writer)
phpoffice/phpspreadsheet suggests installing dompdf/dompdf (Option for rendering PDF with PDF Writer)
phpoffice/phpspreadsheet suggests installing tecnickcom/tcpdf (Option for rendering PDF with PDF Writer)
phpoffice/phpspreadsheet suggests installing jpgraph/jpgraph (Option for rendering charts, or including charts with PDF or HTML Writers)
Writing lock file
Generating autoload files

C:\xampp\htdocs\nouveta\STKPUSH>

The code I have uploaded on Cpanel that has enter image description here

enter image description here enter image description here

Wanjala Alex
  • 141
  • 2
  • 13

1 Answers1

0

I do not see the download code. This $writer->save('hello world.xlsx'); saves file in public folder. It might be there.

Just give a path to file as URL to Download it. You might use below code to download it as well.

<?php header("Location: http://example.com/somFile.xlsx"); ?>