Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGFIX] switch to excel package: phpoffice/phpspreadsheet #37

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Classes/Service/Resources/Excel.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
use PhpOffice\PhpSpreadsheet\IOFactory;
use PhpOffice\PhpSpreadsheet\Reader\IReader;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Core\Environment;

/**
* Description of Excel
Expand Down Expand Up @@ -66,10 +66,10 @@ public function parseResource()
$configuration = $this->getConfiguration();

if (!\class_exists(IOFactory::class)) {
throw new \Exception('PHP Excel is needed! Please install phpoffice/phpexcel (composer mode)', 12367812368);
throw new \Exception('PHP Excel is needed! Please install phpoffice/phpspreadsheet (composer mode)', 12367812368);
}

$filename = GeneralUtility::getFileAbsFileName($this->filepath);
$filename = Environment::getPublicPath() . $this->filepath;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @lochmueller,
why did you change this line? This would NOT have the same effect. I think we originally used this call to e.g. resolve "EXT:" prefixes, when we now just concatenate this with the filepath that would be something completely different. getFileAbsFileName is also not deprecated 🤔
I'd like to have a little more input on this, thanks!

/** @var IReader $reader */
$reader = IOFactory::createReaderForFile($filename);
$reader->setReadDataOnly(true);
Expand All @@ -88,7 +88,7 @@ public function parseResource()
for ($row = 1 + $configuration['skipRows']; $row <= $highestRow; ++$row) {
$rowRecord = [];
for ($col = 0; $col <= $highestColumnIndex; ++$col) {
$rowRecord[] = \trim(
$rowRecord[] = \trim((string)
$worksheet->getCellByColumnAndRow($col, $row)
->getValue()
);
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"typo3/cms-core": "^10.4||^11.5"
},
"suggest": {
"phpoffice/phpexcel": "Use Excel files as import resource"
"phpoffice/phpspreadsheet": "Use Excel files as import resource"
},
"replace": {
"typo3-ter/importr": "self.version"
Expand Down