<?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: Emailing an XLSX File Created from ODS from a Unix environment in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Emailing-an-XLSX-File-Created-from-ODS-from-a-Unix-environment/m-p/397462#M96059</link>
    <description>&lt;P&gt;I can replicate the problem with:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let attachment=%sysfunc(pathname(work))/MY_FILE.xlsx ;

ods excel file="&amp;amp;attachment";

proc print data=sashelp.class ;
run ;

ods excel close;

filename SENDMAIL email 
  to= "me@blah.com"
  from="me@blah.com"
  subject= "Email Subject"
  attach= ("&amp;amp;attachment") ;
run;

data _null_;
  file SENDMAIL;
run ;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 20 Sep 2017 14:43:08 GMT</pubDate>
    <dc:creator>Quentin</dc:creator>
    <dc:date>2017-09-20T14:43:08Z</dc:date>
    <item>
      <title>Emailing an XLSX File Created from ODS from a Unix environment</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Emailing-an-XLSX-File-Created-from-ODS-from-a-Unix-environment/m-p/397438#M96053</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am attempting to email an XLSX file that is created via ODS from a Unix environment, but I am getting two different error messages when trying to open the file in Excel 2013. The first is: "We found a problem with some cotent in 'MY_FILE.xlsx'.Do you want to try to recover as much as we can? If you trust hte source of this workbook, click Yes." After clicking "Yes", I am getting "Excel cannot open the file "MY_FILE.xlsx" becaause the file format or file extension is not valid. Verify that the file has not been corrupted and that the file extension matches the format of the file."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I download the file via an FTP client directly from the Unix environment, I still get the first message, but after clicking "Yes", Excel can successfully repair the file and I can view the contents.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My SAS version is 9.04 and the code that I am using is below:&lt;/P&gt;&lt;P&gt;&amp;lt;code&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ods excel file="/unix/path/MY_FILE.xlsx";&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc report data=libname.my_dataset headline headskip missing;&lt;BR /&gt;define product/ width=20 display style(column)={tagattr='Format:TEXT'};&lt;BR /&gt;define description/ width=20 display style(column)={tagattr='Format:TEXT'};&lt;BR /&gt;define total/ width=20 display style(column)={tagattr='Format:TEXT'};&lt;BR /&gt;define sub_total/ width=20 display style(column)={tagattr='Format:TEXT'};&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;ods excel close;&lt;BR /&gt;ODS LISTING;&lt;/P&gt;&lt;P&gt;%let attachment = /unix/path/MY_FILE.xlsx;&lt;BR /&gt;&lt;BR /&gt;filename SENDMAIL email TO= "asdf@email.com"&lt;BR /&gt;subject= "Email Subject"&lt;BR /&gt;type = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"&lt;BR /&gt;attach= ("&amp;amp;attachment");&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;DATA _NULL_;&lt;BR /&gt;file SENDMAIL;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;lt;/code&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried defining the content type in several ways, including adding it into the attachment arguments, but that just attempts to attach random files to the email and I still get the same error messages. I have also tried "application/xlsx" and "application/excel" content-types, both with the same results.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be greatly appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-Jordan&lt;/P&gt;</description>
      <pubDate>Wed, 20 Sep 2017 13:31:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Emailing-an-XLSX-File-Created-from-ODS-from-a-Unix-environment/m-p/397438#M96053</guid>
      <dc:creator>JordanS</dc:creator>
      <dc:date>2017-09-20T13:31:58Z</dc:date>
    </item>
    <item>
      <title>Re: Emailing an XLSX File Created from ODS from a Unix environment</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Emailing-an-XLSX-File-Created-from-ODS-from-a-Unix-environment/m-p/397462#M96059</link>
      <description>&lt;P&gt;I can replicate the problem with:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let attachment=%sysfunc(pathname(work))/MY_FILE.xlsx ;

ods excel file="&amp;amp;attachment";

proc print data=sashelp.class ;
run ;

ods excel close;

filename SENDMAIL email 
  to= "me@blah.com"
  from="me@blah.com"
  subject= "Email Subject"
  attach= ("&amp;amp;attachment") ;
run;

data _null_;
  file SENDMAIL;
run ;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Sep 2017 14:43:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Emailing-an-XLSX-File-Created-from-ODS-from-a-Unix-environment/m-p/397462#M96059</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2017-09-20T14:43:08Z</dc:date>
    </item>
    <item>
      <title>Re: Emailing an XLSX File Created from ODS from a Unix environment</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Emailing-an-XLSX-File-Created-from-ODS-from-a-Unix-environment/m-p/397775#M96156</link>
      <description>&lt;P&gt;Thanks for the verfication! Glad I'm not the only one. We've created a work around by just zipping the file first and attaching, but I'd rather not have to do that long term.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-Jordan&lt;/P&gt;</description>
      <pubDate>Thu, 21 Sep 2017 13:39:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Emailing-an-XLSX-File-Created-from-ODS-from-a-Unix-environment/m-p/397775#M96156</guid>
      <dc:creator>JordanS</dc:creator>
      <dc:date>2017-09-21T13:39:56Z</dc:date>
    </item>
  </channel>
</rss>

