<?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: excel engine - replace the content of a sheet created using ods excel in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/excel-engine-replace-the-content-of-a-sheet-created-using-ods/m-p/663807#M24209</link>
    <description>&lt;P&gt;When I empty the sheet I get&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="excel1.JPG" style="width: 472px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/46424iC9434C5BC069EF86/image-size/large?v=v2&amp;amp;px=999" role="button" title="excel1.JPG" alt="excel1.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When we try to add some data in the "empty" tab, we get the following error message:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="sasError"&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;76 data test.'Class$'n;
77 set sashelp.class (where=(sex='F'));
78 run;

ERROR: The MS Excel table Class$ has been opened for OUTPUT. This table already exists, or there is a
name conflict with an existing object. This table will not be replaced. This engine does not
support the REPLACE option.&lt;/CODE&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 21 Jun 2020 07:39:32 GMT</pubDate>
    <dc:creator>xxformat_com</dc:creator>
    <dc:date>2020-06-21T07:39:32Z</dc:date>
    <item>
      <title>excel engine - replace the content of a sheet created using ods excel</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/excel-engine-replace-the-content-of-a-sheet-created-using-ods/m-p/663764#M24205</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know that there is no issue with the xlsx engine but I was wondering on whether there is a solution with the excel engine.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the issue:&lt;/P&gt;&lt;P&gt;When creating an Excel file with the excel engine, it is possible to replace the content of a sheet with some new data, if and only if the content of the sheet is first removed.&lt;/P&gt;&lt;P&gt;When creating an Excel file with ods xlsx, it is possible to remove the data (not the style) using proc datasets for example. But it is not possible to add data in this excel tab using the excel engine.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Question 1. Is there a way to remove everything from the sheet (both data and style).&lt;/P&gt;&lt;P&gt;Question 2. Is it possible to replace the content of an excel sheet using the excel engine when the original file was created using ods excel?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;*--------------------------------------------------------------------;

ods excel file="&amp;amp;test./v1.xlsx" options(sheet_name='Class');

proc print data=sashelp.class noobs;
run;

ods excel close;

*--------------------------------------------------------------------;

libname test excel "&amp;amp;test/v1.xlsx";

proc datasets memtype=data lib=test nolist nodetails;
    delete 'Class$'n;  
    run;
quit;

data test.'Class$'n;
    set sashelp.class (where=(sex='F'));
run;

libname test;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 20 Jun 2020 22:29:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/excel-engine-replace-the-content-of-a-sheet-created-using-ods/m-p/663764#M24205</guid>
      <dc:creator>xxformat_com</dc:creator>
      <dc:date>2020-06-20T22:29:48Z</dc:date>
    </item>
    <item>
      <title>Re: excel engine - replace the content of a sheet created using ods excel</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/excel-engine-replace-the-content-of-a-sheet-created-using-ods/m-p/663773#M24207</link>
      <description>&lt;P&gt;It is important to remember that the LIBNAME EXCEL engine and the ODS EXCEL file format are not functionally equivalent. The former uses the Microsoft ACE/Jet engine to exchange data with Excel workbooks. The latter writes XLSX-formatted files from scratch that Excel can interpret as a workbook.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So the LIBNAME EXCEL engine is limited in its ability to manipulate spreadsheets whereas ODS EXCEL provides much more formatting capability.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What happens when you run your test program?&lt;/P&gt;</description>
      <pubDate>Sat, 20 Jun 2020 23:55:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/excel-engine-replace-the-content-of-a-sheet-created-using-ods/m-p/663773#M24207</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2020-06-20T23:55:41Z</dc:date>
    </item>
    <item>
      <title>Re: excel engine - replace the content of a sheet created using ods excel</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/excel-engine-replace-the-content-of-a-sheet-created-using-ods/m-p/663807#M24209</link>
      <description>&lt;P&gt;When I empty the sheet I get&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="excel1.JPG" style="width: 472px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/46424iC9434C5BC069EF86/image-size/large?v=v2&amp;amp;px=999" role="button" title="excel1.JPG" alt="excel1.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When we try to add some data in the "empty" tab, we get the following error message:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="sasError"&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;76 data test.'Class$'n;
77 set sashelp.class (where=(sex='F'));
78 run;

ERROR: The MS Excel table Class$ has been opened for OUTPUT. This table already exists, or there is a
name conflict with an existing object. This table will not be replaced. This engine does not
support the REPLACE option.&lt;/CODE&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 21 Jun 2020 07:39:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/excel-engine-replace-the-content-of-a-sheet-created-using-ods/m-p/663807#M24209</guid>
      <dc:creator>xxformat_com</dc:creator>
      <dc:date>2020-06-21T07:39:32Z</dc:date>
    </item>
    <item>
      <title>Re: excel engine - replace the content of a sheet created using ods excel</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/excel-engine-replace-the-content-of-a-sheet-created-using-ods/m-p/667052#M24250</link>
      <description>&lt;P&gt;&lt;FONT face="verdana,geneva"&gt;You might not be able to update the file using the EXCEL engine because of this:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;FONT face="verdana,geneva"&gt;&lt;CODE class=" language-sas"&gt;This engine does not support the REPLACE option.&lt;/CODE&gt;&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="verdana,geneva"&gt;Can you use the XSLX engine?&lt;/FONT&gt;&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;PRE&gt;&lt;CODE class=" language-sas"&gt;options validvarname=any validmemname=extend;

ods _all_ close;

ods Excel file='C:\temp\class.xlsx' options(sheet_name='Class');
  proc print data=sashelp.class noobs; run; quit;
ods Excel close;

libname test xlsx 'C:\temp\class.xlsx';

data test.Class;
set sashelp.class(where=(sex='F'));
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="verdana,geneva"&gt;Vince DelGobbo&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="verdana,geneva"&gt;SAS R&amp;amp;D&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 05 Jul 2020 20:32:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/excel-engine-replace-the-content-of-a-sheet-created-using-ods/m-p/667052#M24250</guid>
      <dc:creator>Vince_SAS</dc:creator>
      <dc:date>2020-07-05T20:32:16Z</dc:date>
    </item>
  </channel>
</rss>

