O
O
OneOlOf2021-07-12 10:42:28
PHP
OneOlOf, 2021-07-12 10:42:28

How to make excel from different tables on the page and download by button?

Good afternoon.
I have several tables on the page, tell me how can I click on the button to download all these tables into one excel file?

Here, most likely, JS will be needed (some kind of bible can)?
The bottom line is that there is PHPExcel, I know how to use it, but I want to understand whether it is possible to make such a scheme: I make a

button and bind it to JS, then a request is made to the php file in which this bible works and generates a file, and then the download occurs ( But I need the file not to be saved on the server ).

What is the best way to approach the problem?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
C
Constantine, 2021-07-12
@OneOlOf

For PhpExcel, you need to send the output of the file to the stream

$objPHPExcel->outputHeader("Excel");

$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('php://output');
exit;

V
Vladimir Korotenko, 2021-07-12
@firedragon

Find my article on Habré
There is a code for generating excel and look at the comments there is a lot of indignation, but there are also links to solutions.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question