I have used maatwebsite excel library for Import and Exporting data. i want to set cell wise data like.
A B C D E F
1 heading1 heading2 heading3 heading4 heading5 heading6
2 data1 data2 data3 data4 data5 data6
3 data12 data22 data32 data42 data52 data62
4 data23 data33 data43 data53
5 data34 data44 data54
6 data35 data45 data54
7 data46 data56
8 data47 data57
9 data48
10 data49
11 data50
12 data51
I want to export data something like that i try a lot but not success.
below is my code.
$sheet->fromArray($dataHeading);
I used this function for adding value to excel file. but the problem is this function add value raw wise I want to add value cell wise.
Like first of all I adding value to A
then B
etc...
I can't find any function that allowed me to adding value to cell wise.
please help how can I manage this. i have data as php array like.
array(
'heading1' => array(
'data1','data12'
),
'heading2' => array(
'data2','data22','data23'
),
'heading3' => array(
'data3','data32','data33','data34','data35'
),
'heading4' => array(
'data4','data42','data43','data44','data45','data46','data47','data47','data49','data50','data51'
),
'heading5' => array(
'data5','data52','data53','data54','data56','data57'
),
'heading6' => array(
'data6','data62'
)
)
How can I enter this array to excel file. if I need to change in array please suggest me. i able to change my array.
Thanks
Not sure if it addresses your problem, but seen the title some people trying to just set the value of a single cell might end up here anyway :)
It is not documented but looking in the sourcecode I found it is possible:
$sheet->setCellValue('A1', 'some value');
or
$sheet->cell('A1', function($cell) {
$cell->setValue('some value');
});
A bit off-topic but I hope it helps some people anyway.