You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First, thanks for all the work put into this package. It is awesome.
I have been using this package for a long time now, and just noticed that in the WriterFactory, the setEnclosureRequired method uses the enclosure setting and we have no way of changing that currently (not without a whole lot of other changes, anyway).
I am talking about this line here:
Is there a specific reason why this is not configurable? I might be missing some info here, so if there is a reason for this, I would like to hear it.
I am working on a Google Marketplace feed in a CSV format, and hit a wall, cause, apparently, they can't handle an enclosed comma separated list in a tab delimited csv, which creates some problems with the "Additional image link" option.
According to their documentation (https://support.google.com/merchants/answer/6324370), we can submit more than one image in this format:
if ($enclosure) {
// If enclosure is not required, use enclosure only if// element contains newline, delimiter, or enclosure.if (!$this->enclosureRequired && strpbrk($element, "$delimiter$enclosure\n") === false) {
$enclosure = '';
} else {
$element = str_replace($enclosure, $enclosure . $enclosure, $element);
}
}
So, if it is not forced, it tries to decide if it is needed on its own.
I did a test and changed the line in the WriterFactory to $writer->setEnclosureRequired(false); in my vendor folder (i know, shame on me), and the resulting csv file was totally ok, and even Google managed to eat it.
Since I can't just get rid of the enclosure altogether (we also include product descriptions in the feed and that would get ugly without an enclosure set), I thought I would suggest to include this option in the changable options for csv exports.
What do you guys think?
Would this be something useful?
It would be for me, of course, but I'm curious about other opinions also.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi there!
First, thanks for all the work put into this package. It is awesome.
I have been using this package for a long time now, and just noticed that in the
WriterFactory
, thesetEnclosureRequired
method uses the enclosure setting and we have no way of changing that currently (not without a whole lot of other changes, anyway).I am talking about this line here:
Laravel-Excel/src/Factories/WriterFactory.php
Line 54 in dedf198
Is there a specific reason why this is not configurable? I might be missing some info here, so if there is a reason for this, I would like to hear it.
I am working on a Google Marketplace feed in a CSV format, and hit a wall, cause, apparently, they can't handle an enclosed comma separated list in a tab delimited csv, which creates some problems with the "Additional image link" option.
According to their documentation (https://support.google.com/merchants/answer/6324370), we can submit more than one image in this format:
But with the enclosure option set to
"
, that becomes this:And Google tries to use the whole string that way as a single image link (which will not work, of course).
I did a little digging and PhpSpreadsheet uses this option like this (https://github.com/PHPOffice/PhpSpreadsheet/blob/88908a8a03cb44bdd5583bc209b5629b79c165ab/src/PhpSpreadsheet/Writer/Csv.php#L302):
So, if it is not forced, it tries to decide if it is needed on its own.
I did a test and changed the line in the WriterFactory to
$writer->setEnclosureRequired(false);
in my vendor folder (i know, shame on me), and the resulting csv file was totally ok, and even Google managed to eat it.Since I can't just get rid of the enclosure altogether (we also include product descriptions in the feed and that would get ugly without an enclosure set), I thought I would suggest to include this option in the changable options for csv exports.
What do you guys think?
Would this be something useful?
It would be for me, of course, but I'm curious about other opinions also.
Beta Was this translation helpful? Give feedback.
All reactions