1

I have excel file with sheet names utf-8, and I got trimmed sheet name because this sheet title is more then 31 characters.

My code:

<?php

use PhpOffice\PhpSpreadsheet\Reader\Xlsx;
use PhpOffice\PhpSpreadsheet\IOFactory;

$reader = IOFactory::createReader('Xlsx');
$reader->setReadDataOnly(TRUE);
$spreadsheet = $reader->load('/home/cool-file.xlsx');

$all = $spreadsheet->getSheetNames();

In $all variable I got a list of all sheet names but all names are trimmed.

I tried to comment this part of code: https://github.com/PHPOffice/PhpSpreadsheet/blob/develop/src/PhpSpreadsheet/Worksheet/Worksheet.php#L853-L882

but no changes.

Mowshon
  • 939
  • 9
  • 16

1 Answers1

3
use PhpOffice\PhpSpreadsheet\Reader\Xlsx;
use PhpOffice\PhpSpreadsheet\IOFactory;

$reader = IOFactory::createReader('Xlsx');
$reader->setReadDataOnly(TRUE);
$spreadsheet = $reader->load('/home/cool-file.xlsx');

$all = $spreadsheet->getSheetNames()[1];

Please, note the bracket and the ID of the sheet

fastop
  • 46
  • 4