I am trying to use magento 2 native csv import in my custom module. I am using following step to achieve requirement after some R&D but not working for me. I place csv file with sample data at location self::PATH_FILENAME and it works.

Getting issues

1) Unable to create configurable product variations. But when I try same csv from admin it works.

2) Observer event not working catalog_product_import_bunch_save_after. But when I try same csv from admin it works.

public function _importProducts($rowData){
    $csvModel = $this->csvFactory->create(['destination' => self::PATH_FILENAME]);

    $importModel = $this->importModelFactory->create();


    $sourceModel = \Magento\ImportExport\Model\Import\Adapter::findAdapterFor(

    $isValid = $importModel->validateSource($sourceModel);
    if ($importModel->getProcessedRowsCount() === 0 || 
        !$isValid || 
    ) {

    try {
    } catch (\Exception $e) {
        throw new \Exception($e->getMessage());

Note : I am using command line 'php bin/magento custom:import' for execute.

If you guys have any Idea please share

Any help will be appreciated

  • could you please post exact error? and which place you put the CSV file? – Keyur Shah Apr 29 '19 at 16:57
  • NO error and I put csv file pub/media/customimport – Chander Shekhar Apr 30 '19 at 6:25
  • @ChanderShekhar , Have you found any solution for this? – krupa parikh Aug 16 '19 at 5:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.