How to attached Download sample file at Import functionality in Magento 2?

Magento 2, Out of the Box provides Import functionality for Catalog and Customer entity from admin panel via System -> Data Transfer
-> Import link.

You can create your own new entity type for import data using the Import link. When you create your own module you need to attached Download sample file for new user to easily manage Import data.

Download sample file is the sample CSV file for import data into System.

Let’s assume you have created an import.xml file under etc/import.xml folder,

<?xml version="1.0"?>

<config xmlns:xsi="" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_ImportExport:etc/import.xsd">
    <entity name="extra_data" label="Extra Data" model="Rbj\ImportData\Model\Import\Extra" behaviorModel="Magento\ImportExport\Model\Source\Import\Behavior\Basic" />

Now you have to create di.xml at the global location,

<?xml version="1.0"?>
 * Dependency injection file
 * @author Rakesh Jesadiya
 * @package Rbj_ImportData
<config xmlns:xsi=""
    <type name="Magento\ImportExport\Model\Import\SampleFileProvider">
            <argument name="samples" xsi:type="array">
                <item name="extra_data" xsi:type="string">Rbj_ImportData</item>

Now create a function in Model file,
a path for my module based on the import.xml file model attribute, Rbj\ImportData\Model\Import\Extra.php

public function getEntityTypeCode()
    return 'extra_data';

Now you have to create one CSV file inside your module at below path,
<Packagename>/<Modulename>/Files/Sample/extra_data.csv file, CSV file contains the Sample data you have to import.

import Download Sample Data CSV
import Download Sample Data CSV

Now you click on Download Sample file with your new entity option selected, File is downloaded with your sample data.