1.Create di.xml in your module [etc/di.xml]
<?xml version="1.0" encoding="UTF-8"?>
<config
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\Ui\Model\Export\MetadataProvider">
<plugin name="export_custmer_csv_row_data" type="VendorName\ModuleName\Model\Plugin\ExportRowDataModification" sortOrder="1" disabled="false"/>
</type>
- Create Plugin Model [VendorName\ModuleName\Model\ExportRowDataModification.php]
<?php
namespace VendorName\ModuleName\Model\Plugin;
class ExportRowDataModification
{
protected $resource;
public function __construct(
\Magento\Framework\App\ResourceConnection $resource
)
{
$this->resource = $resource;
}
public function afterGetRowData($subject, $result, $document, $fields, $options)
{
$i = 0;
foreach ($fields as $column) {
//########## example formate
if ($column === 'your_colum_name_place_here') {
//do your logic here
}
//######### in my case
//is old customer
if ( $column === 'is_old_customer') {
$result[$i] = (int)$result[$i] === 1 ? 'Yes' : 'No';
}
// change zone value to label
if ($column === 'zone') {
$zoneCollection = $this->zoneCollectionFactory->create();
$zoneCollection->addFieldToFilter('zone_id', (int)$result[$i]);
$zone = $zoneCollection->getFirstItem()->getName();
$result[$i] = $zone;
}
$i++;
}
return $result;
}
}
Thanks, @m2dubai for the knowledge