<?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 Export tables to an existing macro-enabled Excel file in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Export-tables-to-an-existing-macro-enabled-Excel-file/m-p/909693#M358792</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have an Excel file, xlsm, that has formulas to fill up reports.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to find a way, of running SAS programs, and then all the tables will be exported to that Excel. Ideally, the data will be sent to the cells that are linked already to the formulas.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it doable ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;If not, can I export to the file to another sheet ? of course without taking the risk of ruining anything in the file.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 26 Dec 2023 14:16:05 GMT</pubDate>
    <dc:creator>yaniv_daaata</dc:creator>
    <dc:date>2023-12-26T14:16:05Z</dc:date>
    <item>
      <title>Export tables to an existing macro-enabled Excel file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-tables-to-an-existing-macro-enabled-Excel-file/m-p/909693#M358792</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have an Excel file, xlsm, that has formulas to fill up reports.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to find a way, of running SAS programs, and then all the tables will be exported to that Excel. Ideally, the data will be sent to the cells that are linked already to the formulas.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it doable ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;If not, can I export to the file to another sheet ? of course without taking the risk of ruining anything in the file.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Dec 2023 14:16:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-tables-to-an-existing-macro-enabled-Excel-file/m-p/909693#M358792</guid>
      <dc:creator>yaniv_daaata</dc:creator>
      <dc:date>2023-12-26T14:16:05Z</dc:date>
    </item>
    <item>
      <title>Re: Export tables to an existing macro-enabled Excel file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-tables-to-an-existing-macro-enabled-Excel-file/m-p/909707#M358802</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why not try it and see if it causes any trouble?&amp;nbsp; Make a copy of the file to work with so you don't lose your original file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You cannot write to named ranges of individual cells.&lt;/P&gt;
&lt;P&gt;You can create a new worksheet in the workbook.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If by "macro enabled" you mean you have an XLSM file instead of an XLSX file then make sure to use the right extension when specifying the filename.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You might need to make the macros in the Excel file smart enough to find the new sheet if you want them to use the data.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Dec 2023 20:07:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-tables-to-an-existing-macro-enabled-Excel-file/m-p/909707#M358802</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-12-26T20:07:17Z</dc:date>
    </item>
    <item>
      <title>Re: Export tables to an existing macro-enabled Excel file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-tables-to-an-existing-macro-enabled-Excel-file/m-p/909713#M358806</link>
      <description>Which method would you use ? Proc export ? ODS ?&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 26 Dec 2023 22:36:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-tables-to-an-existing-macro-enabled-Excel-file/m-p/909713#M358806</guid>
      <dc:creator>yaniv_daaata</dc:creator>
      <dc:date>2023-12-26T22:36:16Z</dc:date>
    </item>
    <item>
      <title>Re: Export tables to an existing macro-enabled Excel file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-tables-to-an-existing-macro-enabled-Excel-file/m-p/909714#M358807</link>
      <description>&lt;P&gt;You can't use ODS EXCEL to update an existing Excel workbook, it has to be created from scratch each time.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PROC EXPORT enables you to replace or add a complete sheet in a workbook, or a range within a sheet. If you have formulas, they should be in a permanent sheet that is not overwritten by SAS.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Dec 2023 22:47:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-tables-to-an-existing-macro-enabled-Excel-file/m-p/909714#M358807</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2023-12-26T22:47:10Z</dc:date>
    </item>
    <item>
      <title>Re: Export tables to an existing macro-enabled Excel file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Export-tables-to-an-existing-macro-enabled-Excel-file/m-p/909720#M358811</link>
      <description>&lt;P&gt;Afaik SAS does not directly support .xlsm &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/v_046/acpcref/p1d0tocg3njhmfn1d4ld2covlwm0.htm#p1c3qb1gtl5y4vn1nvfyxyprnrns" target="_self"&gt;Proc Export: DBMS=data-source-identifier&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;You could use Python package openpyxl for writing to this .xlsm. From a design perspective: I'd keep the "raw" data in separate sheets.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For SAS to interface with Python:&lt;/P&gt;
&lt;P&gt;If you've got SAS Viya then use Proc Python, if you've got SAS9.4 then call the Python script via call system() or the like (needs option XCMD set).&lt;/P&gt;</description>
      <pubDate>Wed, 27 Dec 2023 01:39:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Export-tables-to-an-existing-macro-enabled-Excel-file/m-p/909720#M358811</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2023-12-27T01:39:01Z</dc:date>
    </item>
  </channel>
</rss>

