<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Exported XLSX file unable to open  corrupted in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Exported-XLSX-file-unable-to-open-corrupted/m-p/813748#M321189</link>
    <description>Yes tried still the same issues unable to open xlsx (attach="/workspace/lob5/alm/u441070/xyz.xlsx" content_type="application/xlsx");&lt;BR /&gt;&lt;BR /&gt;Hence thinking to use Text file with Tab delimited options if xlsx is not working</description>
    <pubDate>Tue, 17 May 2022 10:52:07 GMT</pubDate>
    <dc:creator>Ashpak</dc:creator>
    <dc:date>2022-05-17T10:52:07Z</dc:date>
    <item>
      <title>Exported XLSX file unable to open  corrupted</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exported-XLSX-file-unable-to-open-corrupted/m-p/813469#M321061</link>
      <description>&lt;P&gt;Hi All&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have created below code to export my SAS data set into xlsx file with multiple sheets, file got created and sent email with attachment but xls file unable to open , its says file is corrupted,&amp;nbsp; if we manually transfer xlsx file from SAS server to windows Desktop through WINSCP, file gets opened , but its not opening through email and SAS server locations. here is the code. Appreciate your help on this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;libname x xlsx "/workspace/lob5/alm/u441070/xyz.xlsx";&lt;BR /&gt;data x.DQ_Pricing_Completeness;&lt;BR /&gt;set work.pdq001;&lt;BR /&gt;run;&lt;BR /&gt;data x.DQ_Pricing_Integrity;&lt;BR /&gt;set work.pdq002;&lt;BR /&gt;run;&lt;BR /&gt;%macro SendEmailFAST;&lt;BR /&gt;filename outbox email&lt;BR /&gt;to=(&amp;amp;emailTo1)&lt;BR /&gt;from=(&amp;amp;emailFrom)&lt;BR /&gt;cc=(&amp;amp;emailCC)&lt;BR /&gt;bcc=(&amp;amp;emailbcc)&lt;BR /&gt;type='text/html'&lt;BR /&gt;subject= "Data Quality Run &amp;amp;scn -&amp;amp;dbn &amp;amp;taday"&lt;BR /&gt;attach="/workspace/lob5/alm/u441070/xyz.xlsx" ;&lt;BR /&gt;ODS html body=outbox style=Harvest; /*BarrettsBlue*/&lt;BR /&gt;/* Pricing*/&lt;BR /&gt;Title1 color=red H=3 "Data Quality Exceptions Report NVP Pricing Templates for &amp;amp;scn%";&lt;BR /&gt;proc report data=Email_Fast_Rep_Pricing ;&lt;BR /&gt;columns CNT DQ_Dimension DQRule Field DQCHEK_POINT DQPriority;&lt;BR /&gt;define DQPriority / display; /* explicitly specify column usage */&lt;BR /&gt;define DQCHEK_POINT / display;&lt;BR /&gt;compute DQPriority;&lt;BR /&gt;if DQPriority='High' then call define(_col_, "style", "style=[backgroundcolor=Red]");&lt;BR /&gt;if DQPriority='Medium' then call define(_col_, "style", "style=[backgroundcolor=coral]");&lt;BR /&gt;if DQPriority='Low' then call define(_col_, "style", "style=[backgroundcolor=cyan]");&lt;BR /&gt;if DQPriority='No Actions' then call define(_col_, "style", "style=[backgroundcolor=Green]");&lt;BR /&gt;endcomp;&lt;BR /&gt;compute DQCHEK_POINT;&lt;BR /&gt;if DQCHEK_POINT='Fail' then call define (_col_, 'style', 'style=[foreground=Red]');&lt;BR /&gt;endcomp;&lt;BR /&gt;run;&lt;BR /&gt;Title1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ods _all_ close;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;%mend;&lt;BR /&gt;%SendEmailFAST;&lt;/P&gt;</description>
      <pubDate>Mon, 16 May 2022 14:32:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exported-XLSX-file-unable-to-open-corrupted/m-p/813469#M321061</guid>
      <dc:creator>Ashpak</dc:creator>
      <dc:date>2022-05-16T14:32:40Z</dc:date>
    </item>
    <item>
      <title>Re: Exported XLSX file unable to open  corrupted</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exported-XLSX-file-unable-to-open-corrupted/m-p/813482#M321069</link>
      <description>&lt;P&gt;CLOSE the library connection before sending the email would be my first suggestion. Use:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;LIbname x clear;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;after adding the data but before calling the email macro.&lt;/P&gt;
&lt;P&gt;The Libname means that SAS is still using the file and is very likely to cause problems like this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note: post code and log entries into a text box opened with the forum's &amp;lt;/&amp;gt; icon to improve readability.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/337616"&gt;@Ashpak&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi All&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have created below code to export my SAS data set into xlsx file with multiple sheets, file got created and sent email with attachment but xls file unable to open , its says file is corrupted,&amp;nbsp; if we manually transfer xlsx file from SAS server to windows Desktop through WINSCP, file gets opened , but its not opening through email and SAS server locations. here is the code. Appreciate your help on this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;libname x xlsx "/workspace/lob5/alm/u441070/xyz.xlsx";&lt;BR /&gt;data x.DQ_Pricing_Completeness;&lt;BR /&gt;set work.pdq001;&lt;BR /&gt;run;&lt;BR /&gt;data x.DQ_Pricing_Integrity;&lt;BR /&gt;set work.pdq002;&lt;BR /&gt;run;&lt;BR /&gt;%macro SendEmailFAST;&lt;BR /&gt;filename outbox email&lt;BR /&gt;to=(&amp;amp;emailTo1)&lt;BR /&gt;from=(&amp;amp;emailFrom)&lt;BR /&gt;cc=(&amp;amp;emailCC)&lt;BR /&gt;bcc=(&amp;amp;emailbcc)&lt;BR /&gt;type='text/html'&lt;BR /&gt;subject= "Data Quality Run &amp;amp;scn -&amp;amp;dbn &amp;amp;taday"&lt;BR /&gt;attach="/workspace/lob5/alm/u441070/xyz.xlsx" ;&lt;BR /&gt;ODS html body=outbox style=Harvest; /*BarrettsBlue*/&lt;BR /&gt;/* Pricing*/&lt;BR /&gt;Title1 color=red H=3 "Data Quality Exceptions Report NVP Pricing Templates for &amp;amp;scn%";&lt;BR /&gt;proc report data=Email_Fast_Rep_Pricing ;&lt;BR /&gt;columns CNT DQ_Dimension DQRule Field DQCHEK_POINT DQPriority;&lt;BR /&gt;define DQPriority / display; /* explicitly specify column usage */&lt;BR /&gt;define DQCHEK_POINT / display;&lt;BR /&gt;compute DQPriority;&lt;BR /&gt;if DQPriority='High' then call define(_col_, "style", "style=[backgroundcolor=Red]");&lt;BR /&gt;if DQPriority='Medium' then call define(_col_, "style", "style=[backgroundcolor=coral]");&lt;BR /&gt;if DQPriority='Low' then call define(_col_, "style", "style=[backgroundcolor=cyan]");&lt;BR /&gt;if DQPriority='No Actions' then call define(_col_, "style", "style=[backgroundcolor=Green]");&lt;BR /&gt;endcomp;&lt;BR /&gt;compute DQCHEK_POINT;&lt;BR /&gt;if DQCHEK_POINT='Fail' then call define (_col_, 'style', 'style=[foreground=Red]');&lt;BR /&gt;endcomp;&lt;BR /&gt;run;&lt;BR /&gt;Title1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ods _all_ close;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;%mend;&lt;BR /&gt;%SendEmailFAST;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 May 2022 15:28:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exported-XLSX-file-unable-to-open-corrupted/m-p/813482#M321069</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-05-16T15:28:05Z</dc:date>
    </item>
    <item>
      <title>Re: Exported XLSX file unable to open  corrupted</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exported-XLSX-file-unable-to-open-corrupted/m-p/813488#M321072</link>
      <description>Still the problem same unable to open even after closing libname before calling to email macros.&lt;BR /&gt;&lt;BR /&gt;LIbname x clear;</description>
      <pubDate>Mon, 16 May 2022 16:31:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exported-XLSX-file-unable-to-open-corrupted/m-p/813488#M321072</guid>
      <dc:creator>Ashpak</dc:creator>
      <dc:date>2022-05-16T16:31:01Z</dc:date>
    </item>
    <item>
      <title>Re: Exported XLSX file unable to open  corrupted</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exported-XLSX-file-unable-to-open-corrupted/m-p/813489#M321073</link>
      <description>&lt;P&gt;Can you open the file before sending the email?&lt;/P&gt;</description>
      <pubDate>Mon, 16 May 2022 16:45:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exported-XLSX-file-unable-to-open-corrupted/m-p/813489#M321073</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-05-16T16:45:20Z</dc:date>
    </item>
    <item>
      <title>Re: Exported XLSX file unable to open  corrupted</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exported-XLSX-file-unable-to-open-corrupted/m-p/813491#M321075</link>
      <description>&lt;P&gt;Corrupted files cannot be opened. Something is corrupting it in the e-mail process. This really isn't a SAS issue at all.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 May 2022 16:50:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exported-XLSX-file-unable-to-open-corrupted/m-p/813491#M321075</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-05-16T16:50:52Z</dc:date>
    </item>
    <item>
      <title>Re: Exported XLSX file unable to open  corrupted</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exported-XLSX-file-unable-to-open-corrupted/m-p/813495#M321079</link>
      <description>Since file is written in Unix environment location if we open the file in binary formats</description>
      <pubDate>Mon, 16 May 2022 16:56:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exported-XLSX-file-unable-to-open-corrupted/m-p/813495#M321079</guid>
      <dc:creator>Ashpak</dc:creator>
      <dc:date>2022-05-16T16:56:38Z</dc:date>
    </item>
    <item>
      <title>Re: Exported XLSX file unable to open  corrupted</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exported-XLSX-file-unable-to-open-corrupted/m-p/813638#M321145</link>
      <description>&lt;P&gt;Try modifying your FILENAME statement to ensure your attachment is recognised as an XLSX-type spreadsheet.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename outbox email
to=(&amp;amp;emailTo1)
from=(&amp;amp;emailFrom)
cc=(&amp;amp;emailCC)
bcc=(&amp;amp;emailbcc)
type='text/html'
subject= "Data Quality Run &amp;amp;scn -&amp;amp;dbn &amp;amp;taday"
(attach="/workspace/lob5/alm/u441070/xyz.xlsx" content_type="application/xlsx");&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 16 May 2022 23:34:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exported-XLSX-file-unable-to-open-corrupted/m-p/813638#M321145</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2022-05-16T23:34:15Z</dc:date>
    </item>
    <item>
      <title>Re: Exported XLSX file unable to open  corrupted</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exported-XLSX-file-unable-to-open-corrupted/m-p/813745#M321187</link>
      <description>&lt;P&gt;Did you already try what&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13976"&gt;@SASKiwi&lt;/a&gt;&amp;nbsp;proposes. That looks promising as it tells the email server that the attachment is of type XLSX so the email server won't do "bad things" to it.&lt;/P&gt;</description>
      <pubDate>Tue, 17 May 2022 10:47:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exported-XLSX-file-unable-to-open-corrupted/m-p/813745#M321187</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2022-05-17T10:47:44Z</dc:date>
    </item>
    <item>
      <title>Re: Exported XLSX file unable to open  corrupted</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exported-XLSX-file-unable-to-open-corrupted/m-p/813748#M321189</link>
      <description>Yes tried still the same issues unable to open xlsx (attach="/workspace/lob5/alm/u441070/xyz.xlsx" content_type="application/xlsx");&lt;BR /&gt;&lt;BR /&gt;Hence thinking to use Text file with Tab delimited options if xlsx is not working</description>
      <pubDate>Tue, 17 May 2022 10:52:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exported-XLSX-file-unable-to-open-corrupted/m-p/813748#M321189</guid>
      <dc:creator>Ashpak</dc:creator>
      <dc:date>2022-05-17T10:52:07Z</dc:date>
    </item>
    <item>
      <title>Re: Exported XLSX file unable to open  corrupted</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exported-XLSX-file-unable-to-open-corrupted/m-p/813755#M321193</link>
      <description>&lt;P&gt;I've sent in the past XLSX email attachments created in a Linux environment and never had such problems.&lt;/P&gt;</description>
      <pubDate>Tue, 17 May 2022 11:12:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exported-XLSX-file-unable-to-open-corrupted/m-p/813755#M321193</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2022-05-17T11:12:08Z</dc:date>
    </item>
    <item>
      <title>Re: Exported XLSX file unable to open  corrupted</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exported-XLSX-file-unable-to-open-corrupted/m-p/813968#M321276</link>
      <description>Is this problem with Sas enterprise guide version , I’m using sas EG7.1 version</description>
      <pubDate>Wed, 18 May 2022 00:05:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exported-XLSX-file-unable-to-open-corrupted/m-p/813968#M321276</guid>
      <dc:creator>Ashpak</dc:creator>
      <dc:date>2022-05-18T00:05:24Z</dc:date>
    </item>
    <item>
      <title>Re: Exported XLSX file unable to open  corrupted</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Exported-XLSX-file-unable-to-open-corrupted/m-p/813969#M321277</link>
      <description>&lt;P&gt;You are using your SAS server to send the email so your EG version is irrelevant. SAS version could be relevant though, so post the results of this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%put &amp;amp;SYSVLONG;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I suggest that you try this test - upload a known good XLSX spreadsheet to your SAS server. Then email it to yourself using your SAS program. Does it open OK? If so there is nothing wrong with the SAS email attachment process. There must be something wrong with the original spreadsheet you are trying to attach.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 May 2022 01:12:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Exported-XLSX-file-unable-to-open-corrupted/m-p/813969#M321277</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2022-05-18T01:12:47Z</dc:date>
    </item>
  </channel>
</rss>

