magento2-module-catalog-import-command
magento2-module-catalog-import-command copied to clipboard
How to pass seperators
How can I pass parameters like "field separator" and "multiple value separator"?
Hello, you found a solution?
It's currently not supported by this module.
To specify a different field separator, you may want to take a look at Model/Import.php file : https://github.com/cedricblondeau/magento2-module-catalog-import-command/blob/master/Model/Import.php#L73.
\Magento\ImportExport\Model\Import\Source\CsvFactory builds a Magento\ImportExport\Model\Import\Source\Csv object. Source\Csv constructor takes delimiter and enclosure parameters (see: https://github.com/magento/magento2/blob/develop/app/code/Magento/ImportExport/Model/Import/Source/Csv.php#L41).
So, I guess you could do something like this:
$csvSource = $this->csvSourceFactory->create(
[
'file' => $pathInfo['basename'],
'directory' => $this->readFactory->create($pathInfo['dirname']),
'delimiter' => ';',
'enclosure' => '|'
]
);
$validate = $this->importModel->validateSource($csvSource);