I am working on CSV Export. This file is to be uploaded in ftp server. This is the code I am using to export. It is exporting but along with data it is exporting the header as well. I have added image below.
$now = new DateTime();$date = $now->format('YmdHis');$filename = $this->ftpOrderPath. "Order_$date.csv";$response = new Response();$response->headers->set('Content-type', 'text/csv');$response->headers->set('Content-Disposition', 'attachment; filename="' . $filename . '";');$response->sendHeaders();$content = $response->setContent($content);$this->defaultStorage->write($filename, $content);
Can anybody help me how can I remove those headers from my CSV ?