<?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: Replacing a sheet in an excel workbook in Microsoft Integration with SAS</title>
    <link>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Replacing-a-sheet-in-an-excel-workbook/m-p/99804#M1197</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Found the answer to the question I posed; apparently the technique illustrated is very specific to .xls formatted Excel files.&amp;nbsp; I ended up using a Proc Export with a Replace option, but had to name the tab and the columns on that tab with a named range identical to the tab name.&amp;nbsp; Example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Proc Export data=work.scores&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; outfile='c:\temp\classes.xlsx'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; dbms=EXCEL&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Replace;&lt;/P&gt;&lt;P&gt;&amp;nbsp; sheet='classscores';&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The tab classscores had a named range of classscores defined on it as well.&amp;nbsp; SAS was able to delete and replace the contents nicely.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many thanks to Sandy O in SAS' tech support for pointing me in the right direction.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;--Ben&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 02 Oct 2013 18:59:44 GMT</pubDate>
    <dc:creator>BenConner</dc:creator>
    <dc:date>2013-10-02T18:59:44Z</dc:date>
    <item>
      <title>Replacing a sheet in an excel workbook</title>
      <link>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Replacing-a-sheet-in-an-excel-workbook/m-p/99803#M1196</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Looking through Art Carpenter's Innovative SAS Techniques, on page 7 he shows a technique for updating a sheet in an excel workbook.&amp;nbsp; In this example he used an Office 97/2003 type workbook (.xls).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tried to duplicate this with a current style workbook in Windows SAS 9.2 and got an error. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;I created a test workbook (test.xlsx) with a single sheet named 'test'.&lt;/LI&gt;&lt;LI&gt;I then used the following libname to get to it:&lt;BR /&gt;libname testx excel '...path to sheet\test.xlsx' scan_text=no;&lt;/LI&gt;&lt;LI&gt;Ran a proc datasets to delete the file (had to use a $ after the name--it couldn't find the sheet name just as 'test'):&lt;BR /&gt;proc datasets library=testx nolist;&lt;BR /&gt;&amp;nbsp; delete 'test$'n;&lt;BR /&gt;&amp;nbsp; quit;&lt;/LI&gt;&lt;LI&gt;Then used a simple data step to try to replace it:&lt;BR /&gt;data testx.'test$'n;&lt;BR /&gt;set temp;&lt;BR /&gt;run;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The error I got back was:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ERROR: The MS Excel table test$ has been opened for OUTPUT.&amp;nbsp; This table already&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; exists, or there is a name conflict with an existing object.&amp;nbsp; This table&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; will not be replaced.&amp;nbsp; This engine does not support the REPLACE option.&lt;/P&gt;&lt;P&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Suggestions?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks much!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;--Ben&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Oct 2013 17:25:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Replacing-a-sheet-in-an-excel-workbook/m-p/99803#M1196</guid>
      <dc:creator>BenConner</dc:creator>
      <dc:date>2013-10-01T17:25:42Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing a sheet in an excel workbook</title>
      <link>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Replacing-a-sheet-in-an-excel-workbook/m-p/99804#M1197</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Found the answer to the question I posed; apparently the technique illustrated is very specific to .xls formatted Excel files.&amp;nbsp; I ended up using a Proc Export with a Replace option, but had to name the tab and the columns on that tab with a named range identical to the tab name.&amp;nbsp; Example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Proc Export data=work.scores&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; outfile='c:\temp\classes.xlsx'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; dbms=EXCEL&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Replace;&lt;/P&gt;&lt;P&gt;&amp;nbsp; sheet='classscores';&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The tab classscores had a named range of classscores defined on it as well.&amp;nbsp; SAS was able to delete and replace the contents nicely.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many thanks to Sandy O in SAS' tech support for pointing me in the right direction.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;--Ben&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Oct 2013 18:59:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Replacing-a-sheet-in-an-excel-workbook/m-p/99804#M1197</guid>
      <dc:creator>BenConner</dc:creator>
      <dc:date>2013-10-02T18:59:44Z</dc:date>
    </item>
  </channel>
</rss>

