Reputation: 840
I wanted to export and save data from my page to Excel using PHP and I found excellent source https://github.com/shuchkin/simplexlsxgen
I can make multiple sheets using this code
$xlsx = SimpleXLSXGen::fromArray( $myarray);
$xlsx->addSheet( $myarray, 'My name for sheet 2' );
$xlsx->addSheet( $myarray, 'My name for sheet 3' );
$xlsx->saveAs($filename.'.xlsx');
But I can't figure out, how can I name my first sheet? Do you have any ideas?
Upvotes: 0
Views: 1379
Reputation: 21
I know it is a little bit late, but I hope it helps others with same question...
use
$xlsx = SimpleXLSXGen::fromArray( $myarray, 'name of first sheet');
instead
$xlsx = SimpleXLSXGen::fromArray( $myarray);
Upvotes: 0
Reputation: 21
Look at source code and find
fromArray( array $rows, $sheetName = null )
comment out null
and pass in new sheetname.
Upvotes: 2