<?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 Appending a sheet to an already existing Excel document with ODS in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Appending-a-sheet-to-an-already-existing-Excel-document-with-ODS/m-p/328935#M17842</link>
    <description>&lt;P&gt;Hello all-&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So I have an excel document that is processed somewhere else, scooped by SAMBA, and reclocated to an Unix drive-&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What I am looking to do is add an excel sheet to that using proc report-&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I attempt to do something like-&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;ods excel file="/apps/sas/datasets/data137/xxx/dev/xxx/data/xxx/xxx_REPORT.xlsx" style=Seaside options(sheet_name="MRN LEVEL DATA" SHEET_INTERVAL= 'PAGE' autofilter='1' FROZEN_ROWHEADERS='no' &lt;BR /&gt;GRIDLINES='ON' embedded_titles='yes' embedded_footnotes='yes');&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;...proc report code...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ods _all_ close&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It &amp;nbsp;simply wipes out all the previous sheets-&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any suggestions welcomed.&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;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 01 Feb 2017 00:05:03 GMT</pubDate>
    <dc:creator>LB</dc:creator>
    <dc:date>2017-02-01T00:05:03Z</dc:date>
    <item>
      <title>Appending a sheet to an already existing Excel document with ODS</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Appending-a-sheet-to-an-already-existing-Excel-document-with-ODS/m-p/328935#M17842</link>
      <description>&lt;P&gt;Hello all-&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So I have an excel document that is processed somewhere else, scooped by SAMBA, and reclocated to an Unix drive-&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What I am looking to do is add an excel sheet to that using proc report-&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I attempt to do something like-&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;ods excel file="/apps/sas/datasets/data137/xxx/dev/xxx/data/xxx/xxx_REPORT.xlsx" style=Seaside options(sheet_name="MRN LEVEL DATA" SHEET_INTERVAL= 'PAGE' autofilter='1' FROZEN_ROWHEADERS='no' &lt;BR /&gt;GRIDLINES='ON' embedded_titles='yes' embedded_footnotes='yes');&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;...proc report code...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ods _all_ close&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It &amp;nbsp;simply wipes out all the previous sheets-&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any suggestions welcomed.&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;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2017 00:05:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Appending-a-sheet-to-an-already-existing-Excel-document-with-ODS/m-p/328935#M17842</guid>
      <dc:creator>LB</dc:creator>
      <dc:date>2017-02-01T00:05:03Z</dc:date>
    </item>
    <item>
      <title>Re: Appending a sheet to an already existing Excel document with ODS</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Appending-a-sheet-to-an-already-existing-Excel-document-with-ODS/m-p/328937#M17843</link>
      <description>&lt;P&gt;I had a similar problem, unfortunately I don't have good news for you, this isn't possible using ODS EXCEL (unless they've made changes in the latest M4 release). &amp;nbsp;Whenever you open a file with "ODS EXCEL FILE=...." it'll kill anything that's already there, so you can't add some data to it, close ODS and then add more later. &amp;nbsp;What I ended up doing was using PROC EXPORT with DBMS = XLSX like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC EXPORT DATA=LIB_1.Dataset_1
            DBMS=XLSX
            OUTFILE="home/username/file.xlsx"
            REPLACE;
    SHEET="Tab Name";
RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This will allow you to add a sheet to an existing Excel file and not clear everything else out. &amp;nbsp; You can do this after the file has been created using ODS EXCEL to add the sheet, or I ended up just using PROC EXPORT for everything, although it doesn't have all of the output options that ODS EXCEL has unfortunately.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2017 00:25:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Appending-a-sheet-to-an-already-existing-Excel-document-with-ODS/m-p/328937#M17843</guid>
      <dc:creator>Sven111</dc:creator>
      <dc:date>2017-02-01T00:25:40Z</dc:date>
    </item>
    <item>
      <title>Re: Appending a sheet to an already existing Excel document with ODS</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Appending-a-sheet-to-an-already-existing-Excel-document-with-ODS/m-p/328939#M17844</link>
      <description>&lt;P&gt;Using ODS requires that you build your Excel file from scratch. You cannot update an existing spreadsheet.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One option would be to import the data from your existing spreadsheet, append your new data then write it out completely using ODS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Other options include PROC EXPORT or the EXCEL / XLSX LIBNAME. You would need SAS/ACCESS to PC Files installed and licensed for that. You have the ability to replace or add sheets in your Excel workbook with these.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2017 00:25:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Appending-a-sheet-to-an-already-existing-Excel-document-with-ODS/m-p/328939#M17844</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2017-02-01T00:25:22Z</dc:date>
    </item>
    <item>
      <title>Re: Appending a sheet to an already existing Excel document with ODS</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Appending-a-sheet-to-an-already-existing-Excel-document-with-ODS/m-p/328941#M17845</link>
      <description>&lt;P&gt;Or create the Excel output and then insert into Excel using Excel tools. If you are generating many sheets from SAS then generate ALL of the SAS output into a single ODS Excel output file and then insert/combine whatever you want to call it.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2017 00:33:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Appending-a-sheet-to-an-already-existing-Excel-document-with-ODS/m-p/328941#M17845</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-02-01T00:33:08Z</dc:date>
    </item>
    <item>
      <title>Re: Appending a sheet to an already existing Excel document with ODS</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Appending-a-sheet-to-an-already-existing-Excel-document-with-ODS/m-p/328955#M17846</link>
      <description>&lt;P&gt;If you have access to Add In for Microsoft Office that could be another option.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2017 02:17:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Appending-a-sheet-to-an-already-existing-Excel-document-with-ODS/m-p/328955#M17846</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-02-01T02:17:07Z</dc:date>
    </item>
    <item>
      <title>Re: Appending a sheet to an already existing Excel document with ODS</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Appending-a-sheet-to-an-already-existing-Excel-document-with-ODS/m-p/329017#M17850</link>
      <description>&lt;P&gt;The simplest way I have found is to reverse the thinking. &amp;nbsp;You have an Excel file as the base, then export your data from SAS (proc report, export etc. doesn't matter, just a format that Excel can read). &amp;nbsp;Then have a macro - doesn't even have to be in the base file - which opesn your SAS output, copies over the data to where it needs to go, and saves the file. &amp;nbsp;Its really very simple, can be done in a couple of lines of VBA code if its just copying a sheet across (note this code is just typed in to give you an idea):&lt;/P&gt;
&lt;P&gt;Sub Sheet_copy ()&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Application.Open "...\your_export file.xlsx"&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Workbook("your_export file.xlsx").Sheets("Sheet1").MoveTo(Workbook("Base.xlsx",After)&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Workbook("your_export file.xlsx).Close&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Workbook("Base.xlsx").Save&lt;/P&gt;
&lt;P&gt;End Sub&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2017 09:44:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Appending-a-sheet-to-an-already-existing-Excel-document-with-ODS/m-p/329017#M17850</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-02-01T09:44:43Z</dc:date>
    </item>
    <item>
      <title>Re: Appending a sheet to an already existing Excel document with ODS</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Appending-a-sheet-to-an-already-existing-Excel-document-with-ODS/m-p/329171#M17851</link>
      <description>&lt;P&gt;Thanks for all your solutions-I thought the proc export as the runner up but I was seeing if there a way otherwise as I like the format controls, etc etc that proc report provides. Oh well. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;VBA is out of the question for multiple reasons as Microft Add-ins. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Lawrence&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Feb 2017 18:11:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Appending-a-sheet-to-an-already-existing-Excel-document-with-ODS/m-p/329171#M17851</guid>
      <dc:creator>LB</dc:creator>
      <dc:date>2017-02-01T18:11:54Z</dc:date>
    </item>
    <item>
      <title>Re: Appending a sheet to an already existing Excel document with ODS</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Appending-a-sheet-to-an-already-existing-Excel-document-with-ODS/m-p/473779#M21190</link>
      <description>&lt;P&gt;It's very old school but you can update specific cells and perform other operations on an existing Excel&amp;nbsp;workbook from SAS using a DDE connection.&amp;nbsp; There are some environmental and scripting issues involved here but if things are set up right and you do some research this method is still available and can be used.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jun 2018 15:10:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Appending-a-sheet-to-an-already-existing-Excel-document-with-ODS/m-p/473779#M21190</guid>
      <dc:creator>JimRibble</dc:creator>
      <dc:date>2018-06-27T15:10:53Z</dc:date>
    </item>
    <item>
      <title>Re: Appending a sheet to an already existing Excel document with ODS</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Appending-a-sheet-to-an-already-existing-Excel-document-with-ODS/m-p/473911#M21199</link>
      <description>&lt;P&gt;Microsoft officially started decommissioning DDE in Dec 2017 due to a security flaw. You may need to get DDE renabled by your IT area.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jun 2018 21:11:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Appending-a-sheet-to-an-already-existing-Excel-document-with-ODS/m-p/473911#M21199</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-06-27T21:11:27Z</dc:date>
    </item>
    <item>
      <title>Re: Appending a sheet to an already existing Excel document with ODS</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Appending-a-sheet-to-an-already-existing-Excel-document-with-ODS/m-p/473995#M21202</link>
      <description>&lt;P&gt;Just going to paraphrase a bit there:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;decommissioning +&amp;nbsp;security flaw !=&amp;nbsp;renabled&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;img id="smileywink" class="emoticon emoticon-smileywink" src="https://communities.sas.com/i/smilies/16x16_smiley-wink.png" alt="Smiley Wink" title="Smiley Wink" /&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jun 2018 08:18:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Appending-a-sheet-to-an-already-existing-Excel-document-with-ODS/m-p/473995#M21202</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-06-28T08:18:03Z</dc:date>
    </item>
  </channel>
</rss>

