<?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 How to replace only one excel sheet and keep other sheets as is in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-replace-only-one-excel-sheet-and-keep-other-sheets-as-is/m-p/759551#M240044</link>
    <description>&lt;P&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;I have an excel file with multiple sheets: Sheet1, Sheet2, Sheet3, Sheet4. I want to run a weekly report that replaces information on Sheet1 but keeps Sheet2, Sheet3, and Sheet4 as is. Currently, my code below replaces Sheet1 with new information but deletes Sheets2-4 in the newly exported file. Can anyone help me figure out what I should code for this, please?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;PROC EXPORT data=new&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;OUTFILE = "T:\filename.xlsx"&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;DBMS = EXCEL REPLACE;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;SHEET = "Sheet1";&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;NEWFILE = YES;&lt;BR /&gt;RUN;&lt;/P&gt;</description>
    <pubDate>Wed, 04 Aug 2021 23:02:39 GMT</pubDate>
    <dc:creator>jlam2</dc:creator>
    <dc:date>2021-08-04T23:02:39Z</dc:date>
    <item>
      <title>How to replace only one excel sheet and keep other sheets as is</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-replace-only-one-excel-sheet-and-keep-other-sheets-as-is/m-p/759551#M240044</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;I have an excel file with multiple sheets: Sheet1, Sheet2, Sheet3, Sheet4. I want to run a weekly report that replaces information on Sheet1 but keeps Sheet2, Sheet3, and Sheet4 as is. Currently, my code below replaces Sheet1 with new information but deletes Sheets2-4 in the newly exported file. Can anyone help me figure out what I should code for this, please?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;PROC EXPORT data=new&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;OUTFILE = "T:\filename.xlsx"&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;DBMS = EXCEL REPLACE;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;SHEET = "Sheet1";&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;NEWFILE = YES;&lt;BR /&gt;RUN;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Aug 2021 23:02:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-replace-only-one-excel-sheet-and-keep-other-sheets-as-is/m-p/759551#M240044</guid>
      <dc:creator>jlam2</dc:creator>
      <dc:date>2021-08-04T23:02:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace only one excel sheet and keep other sheets as is</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-replace-only-one-excel-sheet-and-keep-other-sheets-as-is/m-p/759554#M240046</link>
      <description>&lt;P&gt;Have you tried using a LIBNAME approach instead? I noticed you're using DBMS=EXCEL which is really old, if you're on an older version of SAS this may not work.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname myFile xlsx 'path to xlsx file';

proc sql;
drop table myFile.Sheet1;
quit;

data myFile.Sheet1;
set new;
run;

libname myFile;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/392290"&gt;@jlam2&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;I have an excel file with multiple sheets: Sheet1, Sheet2, Sheet3, Sheet4. I want to run a weekly report that replaces information on Sheet1 but keeps Sheet2, Sheet3, and Sheet4 as is. Currently, my code below replaces Sheet1 with new information but deletes Sheets2-4 in the newly exported file. Can anyone help me figure out what I should code for this, please?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;PROC EXPORT data=new&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;OUTFILE = "T:\filename.xlsx"&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;DBMS = EXCEL REPLACE;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;SHEET = "Sheet1";&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;NEWFILE = YES;&lt;BR /&gt;RUN;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Aug 2021 23:07:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-replace-only-one-excel-sheet-and-keep-other-sheets-as-is/m-p/759554#M240046</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-08-04T23:07:59Z</dc:date>
    </item>
  </channel>
</rss>

