<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[XLSX Recipe Corrupt excel output (email attachment)]]></title><description><![CDATA[<p>Hi guys!<br />
I am trying to send the generated report as an email attachment. However, in the email, the attached excel cannot be opened as it is corrupted/invalid format. I think, it is an file format/data encoding issue because file retrieved from <strong>reportResponse['headers']['permanent-link']</strong> works fine.<br />
Here is the code to send email attachment:</p>
<pre><code>   function(reportError, reportResponse, reportBody){
    attachments: [{
    content: Buffer.from(reportResponse.body).toString('base64'),
    type: &quot;application/vnd.openxmlformats-officedocument.spreadsheetml.sheet&quot;,
    filename: &quot;report.xlsx&quot;,
    disposition: &quot;attachment&quot;}], }
</code></pre>
<p>Also, when I write the content to disk, I face the same issue:<br />
require('fs').writeFileSync(&quot;D:\report.xlsx&quot;, reportResponse.body);</p>
<p>Any idea?<br />
In which format Jsreport stores the report content in reportResponse? binary?</p>
<p>Thanks.</p>
<p>Nazmus</p>
]]></description><link>https://forum.jsreport.net/topic/663/xlsx-recipe-corrupt-excel-output-email-attachment</link><generator>RSS for Node</generator><lastBuildDate>Sat, 13 Jun 2026 14:51:45 GMT</lastBuildDate><atom:link href="https://forum.jsreport.net/topic/663.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 14 Aug 2018 22:19:25 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to XLSX Recipe Corrupt excel output (email attachment) on Tue, 14 Aug 2018 22:20:18 GMT]]></title><description><![CDATA[<p>Hi guys!<br />
I am trying to send the generated report as an email attachment. However, in the email, the attached excel cannot be opened as it is corrupted/invalid format. I think, it is an file format/data encoding issue because file retrieved from <strong>reportResponse['headers']['permanent-link']</strong> works fine.<br />
Here is the code to send email attachment:</p>
<pre><code>   function(reportError, reportResponse, reportBody){
    attachments: [{
    content: Buffer.from(reportResponse.body).toString('base64'),
    type: &quot;application/vnd.openxmlformats-officedocument.spreadsheetml.sheet&quot;,
    filename: &quot;report.xlsx&quot;,
    disposition: &quot;attachment&quot;}], }
</code></pre>
<p>Also, when I write the content to disk, I face the same issue:<br />
require('fs').writeFileSync(&quot;D:\report.xlsx&quot;, reportResponse.body);</p>
<p>Any idea?<br />
In which format Jsreport stores the report content in reportResponse? binary?</p>
<p>Thanks.</p>
<p>Nazmus</p>
]]></description><link>https://forum.jsreport.net/post/3308</link><guid isPermaLink="true">https://forum.jsreport.net/post/3308</guid><dc:creator><![CDATA[Nazmus-Sadat]]></dc:creator><pubDate>Tue, 14 Aug 2018 22:20:18 GMT</pubDate></item></channel></rss>