<?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: Importing an Excel file that has not been opened/is in protected view in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Importing-an-Excel-file-that-has-not-been-opened-is-in-protected/m-p/899022#M355355</link>
    <description>Can you add the location to your trusted locations in Excel?&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://support.microsoft.com/en-us/office/add-remove-or-change-a-trusted-location-in-microsoft-office-7ee1cdc2-483e-4cbb-bcb3-4e7c67147fb4" target="_blank"&gt;https://support.microsoft.com/en-us/office/add-remove-or-change-a-trusted-location-in-microsoft-office-7ee1cdc2-483e-4cbb-bcb3-4e7c67147fb4&lt;/A&gt;&lt;BR /&gt;</description>
    <pubDate>Tue, 17 Oct 2023 21:16:51 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2023-10-17T21:16:51Z</dc:date>
    <item>
      <title>Importing an Excel file that has not been opened/is in protected view</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-an-Excel-file-that-has-not-been-opened-is-in-protected/m-p/899018#M355353</link>
      <description>&lt;P&gt;I think I may have a rather unique issue and have not yet found a viable solution. I am using &lt;A href="https://github.com/statgeek/SAS-Tutorials/blob/master/Import_all_files_one_type" target="_self"&gt;this macro&lt;/A&gt;&amp;nbsp;to scan a folder for xlsx files, create a list of files in the folder (all of identical format), and then import them. I am interested in importing 6 sheets from each file so I have adjusted the code accordingly. The reason I mention this is because I will be importing thousands of files, each exported manually from on online database and saved to said folder. The issue I am running into using a simple proc import step with sheet statements (tested outside of macro) is "&lt;SPAN&gt;ERROR: Couldn't find sheet in spreadsheet." When commenting out the sheet statement and trying to just import the file (defaulting to importing the first sheet) I get "&lt;/SPAN&gt;No worksheets in the .XLSX file Requested Input File Is Invalid ERROR: Import unsuccessful. See SAS Log for details." After diligently checking sheet names, file names, etc., I have discovered that the issue lies in one of two problem: 1) these files are not being opened and saved prior to attempting to import them into SAS which may or may not tie into 2) the files are in protected view and have not been opened and saved to enable editing. Does anyone have any ideas how I could get around this without opening and saving every single file? Again, there are thousands.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Oct 2023 20:21:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-an-Excel-file-that-has-not-been-opened-is-in-protected/m-p/899018#M355353</guid>
      <dc:creator>sas_user_2023</dc:creator>
      <dc:date>2023-10-17T20:21:22Z</dc:date>
    </item>
    <item>
      <title>Re: Importing an Excel file that has not been opened/is in protected view</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-an-Excel-file-that-has-not-been-opened-is-in-protected/m-p/899022#M355355</link>
      <description>Can you add the location to your trusted locations in Excel?&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://support.microsoft.com/en-us/office/add-remove-or-change-a-trusted-location-in-microsoft-office-7ee1cdc2-483e-4cbb-bcb3-4e7c67147fb4" target="_blank"&gt;https://support.microsoft.com/en-us/office/add-remove-or-change-a-trusted-location-in-microsoft-office-7ee1cdc2-483e-4cbb-bcb3-4e7c67147fb4&lt;/A&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 17 Oct 2023 21:16:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-an-Excel-file-that-has-not-been-opened-is-in-protected/m-p/899022#M355355</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-10-17T21:16:51Z</dc:date>
    </item>
    <item>
      <title>Re: Importing an Excel file that has not been opened/is in protected view</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-an-Excel-file-that-has-not-been-opened-is-in-protected/m-p/899030#M355359</link>
      <description>Thanks for the suggestion. Unfortunately, that did not work</description>
      <pubDate>Tue, 17 Oct 2023 21:36:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-an-Excel-file-that-has-not-been-opened-is-in-protected/m-p/899030#M355359</guid>
      <dc:creator>sas_user_2023</dc:creator>
      <dc:date>2023-10-17T21:36:21Z</dc:date>
    </item>
    <item>
      <title>Re: Importing an Excel file that has not been opened/is in protected view</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-an-Excel-file-that-has-not-been-opened-is-in-protected/m-p/899037#M355364</link>
      <description>&lt;P&gt;Have you tried the EXCEL or XLSX LIBNAME engines? They may behave differently to that macro.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Oct 2023 00:25:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-an-Excel-file-that-has-not-been-opened-is-in-protected/m-p/899037#M355364</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2023-10-18T00:25:52Z</dc:date>
    </item>
    <item>
      <title>Re: Importing an Excel file that has not been opened/is in protected view</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-an-Excel-file-that-has-not-been-opened-is-in-protected/m-p/899056#M355367</link>
      <description>&lt;P&gt;I couldn't replicate the issue you describe in my SAS9.4M7 Windows workstation environment.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've downloaded from the Reserve Bank of Australia Excel&amp;nbsp;&lt;A href="https://www.rba.gov.au/statistics/tables/xls/a03-2hist.xlsx?v=2023-10-18-13-54-25" target="_blank" rel="noopener"&gt;https://www.rba.gov.au/statistics/tables/xls/a03-2hist.xlsx?v=2023-10-18-13-54-25&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;After the download I can execute both of below code versions without any issues.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* version 1 */
%let workbook=a03-2hist.xlsx;
proc import 
  file="c:\temp\&amp;amp;workbook" dbms=excel replace out=work.test;
  sheet='rba securities lending';
run;

/* version 2 */
%let workbook=a03-2hist.xlsx;
libname test "c:\temp\&amp;amp;workbook" access=readonly;
data _null_;
  set test.'rba securities lending$'n;
run;
libname test clear;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Even after execution of above code when I open the downloaded file via Excel I still get first:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1697599289210.png" style="width: 748px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/88929i85D88E84E8D46003/image-dimensions/748x34?v=v2" width="748" height="34" role="button" title="Patrick_0-1697599289210.png" alt="Patrick_0-1697599289210.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also interesting is that if I download the file via a REST call then I get a file that opens without Protected View.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let workbook=a03-2hist.xlsx;
filename out "c:\temp\&amp;amp;workbook";
proc http
  url="https://www.rba.gov.au/statistics/tables/xls/&amp;amp;workbook?v=2023-10-18-13-54-25"
  method="get" 
  out=out
  ;
run;
filename out clear;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If things aren't working this way for you then you might need to talk to a Windows admin at your site.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Oct 2023 03:38:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-an-Excel-file-that-has-not-been-opened-is-in-protected/m-p/899056#M355367</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2023-10-18T03:38:53Z</dc:date>
    </item>
    <item>
      <title>Re: Importing an Excel file that has not been opened/is in protected view</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-an-Excel-file-that-has-not-been-opened-is-in-protected/m-p/899652#M355575</link>
      <description>&lt;P&gt;Solution: using Microsoft Power Automate instead to &lt;A href="https://powerusers.microsoft.com/t5/Power-Automate-Desktop/how-to-open-Excel-files-one-by-one-in-a-loop-from-a-folder-in/td-p/2235149?lightbox-message-images-2235668=680038iB512F47C9CBC8F4E" target="_self"&gt;automate opening and saving&lt;/A&gt; the downloaded files in the folder. This was the easiest and quickest solution I could piece together to circumvent the issue.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Oct 2023 15:45:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-an-Excel-file-that-has-not-been-opened-is-in-protected/m-p/899652#M355575</guid>
      <dc:creator>sas_user_2023</dc:creator>
      <dc:date>2023-10-23T15:45:02Z</dc:date>
    </item>
  </channel>
</rss>

