Quantcast
Channel: Active questions tagged symfony4 - Stack Overflow
Viewing all articles
Browse latest Browse all 3925

How can I remove the headers that are exported along with data from the CSV file?

$
0
0

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);

enter image description here

Can anybody help me how can I remove those headers from my CSV ?


Viewing all articles
Browse latest Browse all 3925

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>