fileFactory = $fileFactory; $this->moduleDir = $moduleDir; } /** * @throws \Exception */ public function execute() { $file = $this->moduleDir->getDir('Stemcell_Customer').'/data/sample/salesperson.xlsx'; $content['type'] = 'filename'; $content['value'] = $file; $content['rm'] = 0; return $this->fileFactory->create('salesperson.xlsx', $content); } }