Тёмный

Create Excel Using PHPSpreadsheet in CodeIgniter | Download Excel Format 

Knowledge Thrusters
Подписаться 3,6 тыс.
Просмотров 10 тыс.
50% 1

In this video , you will be able to create excel using phpspreadsheet in codeigniter and also download the created excel in downloadable format.
I have created one button with text download format, I will changing that to an anchor tag.
Pass the href of your controller function.
In controller ,
firstly include vendor/autoload.php file
after that use
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
Spreadsheet - for creating a worksheet in excel
xlsx -for creating excel file
we will be passing worksheet (spreadsheet) to xlsx - this will create a excel file that contain a worksheet.
$spreadsheet = new Spreadsheet();
$sheet = $spreadsheet-getActiveSheet();
$sheet- setCellValue('A1', 'Hello World !');
$writer = new Xlsx($spreadsheet);
$writer- save('hello world.xlsx');
For download of excel file, you have to add headers
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="hello_world.xlsx"');
save will save that in a particular folder
For download you need to pass php://output to download in excel
$writer- save("php://output");
In my previous video, I have shown how to install php spreadsheet in codeigniter, if you have not watched it please check it out:
• Installation of PhpSpr...
Documentation:
phpspreadsheet.readthedocs.io...
Starting hello world:
phpspreadsheet.readthedocs.io...
Code Link:
github.com/sushma-singh-yadav...
#codeigniter #knowledgethrusters

Опубликовано:

 

6 май 2021

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 5   
@markeybygeeta4740
@markeybygeeta4740 2 года назад
Thanks For creating valuable videos
@nabilunnajib3505
@nabilunnajib3505 2 года назад
Thanks a lot, it's really help me, i'm stuck on that problem for 2 days long or more
@AlokKejriwal
@AlokKejriwal 3 года назад
How to implement the same Codeigniter 2?
@rockon420ful
@rockon420ful 2 месяца назад
hi I am not able to integrate spread sheet in xampp php8 version - root folder I added vendor folder in vendor folder autoload.php file , add in controller file in top and add name spaces for this line i am getting an error $spreadsheet = new Spreadsheet(); error as - Type: Error Message: Class "Spreadsheet" not found Please let me know ho to fix it
@user-ey8fq8yr1z
@user-ey8fq8yr1z 7 месяцев назад
not getting vendor folder in your code files
Далее
меня не было 9 дней
12:48
Просмотров 1,9 млн
PHP File Download | Download Any File using PHP
6:54
меня не было 9 дней
12:48
Просмотров 1,9 млн