Search code examples
phpspout

How to set Excel sheet title with PHP Spout library


I am exporting Excel work book with more than 1 sheet using PHP Spout library.

How do I set the title for each sheet? By default it is giving sheet1 sheet2 etc.

And I need to provide hyperlink from sheet2 cells to sheet1 cells. How do I set hyperlinks using Spout?


Solution

  • To set the title, you can do this:

    $sheet = $writer->getCurrentSheet();
    $sheet->setName('My custom name');
    

    For hyperlinks, it's not possible to reference another sheet unfortunately