In Magento 2.3 onwards, the sample file can be specified from custom module's di.xml file as below:
<type name="Magento\ImportExport\Model\Import\SampleFileProvider">
<arguments>
<argument name="samples" xsi:type="array">
<item name="custom_import_entity_name"name="custom_import_entity" xsi:type="string">Namespace_ModuleName</item>
</argument>
</arguments>
</type>
Here item name custom_import_entity_namecustom_import_entity should be similar to the entity name defined in Namespace/ModuleName/etc/export.xml file as in the below example.
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_ImportExport:etc/export.xsd">
<entity name="custom_import_entity_name"name="custom_import_entity" label="Products" model="Magento\CatalogImportExport\Model\Export\Product" entityAttributeFilterType="catalog_product"/>
<entityType entity="custom_import_entity_name"entity="custom_import_entity" name="simple" model="Magento\CatalogImportExport\Model\Export\Product\Type\Simple" />
<entityType entity="custom_import_entity_name"entity="custom_import_entity" name="virtual" model="Magento\CatalogImportExport\Model\Export\Product\Type\Simple" />
<fileFormat name="csv" label="CSV" model="Magento\ImportExport\Model\Export\Adapter\Csv" />
</config>
Also, make sure to add the below method in your export entity model class specified in the export.xml file above.
/**
* EAV entity type code getter.
*
* @return string
*/
public function getEntityTypeCode()
{
return 'custom_import_entity';
}
Sample CSV file path: Namespace/ModuleName/Files/Sample/custom_import_entity_namecustom_import_entity.csv