BookmarkSubscribeRSS Feed
jweaver08
Calcite | Level 5

Is anyone aware of a method for exporting an Excel file that is protected or read-only?

 

I am trying to do this within an automated script on the UNIX server. I have seen methods that would work when using PC SAS, but they won't work on the server.

 

Also, I'm not concerned with having a password requirement to open the file... I just want the cells to be read-only (not able to be manipulated/deleted).

 

Thank you!

2 REPLIES 2
Reeza
Super User
Unfortunately I don't think there's a way in Unix, I believe all the PC ways use the OS methods and possibly VB.
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Well, there are several parts to this question.  Lets address the "why" first off.  The main use people have for using Excel as an output format is so they can manipulate the data using Excel functionality.  What you are asking is to restrict this, so the question arises, why use Excel as output format?  If you want to display data and make it hard to change, use PDF or something similar.

 

Next we have the technical limitations.  In most cases creating an Excel file from SAS doesn't happen.  It creates a markedup text file which can be "interpreted" by Excel which then renders this.  As this is a text file it cannot have the technical abilities that the Office format has (Open Office meaning a zip file containing XML snippets and possibly binary components).  As far as I am aware Excel is not even available under Unix, so how would you go about using their tech on a system they dont run on?

 

So I would first suggest that you assess what you are trying to achieve, what is the data to be used for.  If it is data transfer, then setup a data transfer agreement, fix the file structure and use a proper data transfer format - CSV or XML for instance.  If the data is for a report, use a proper report format, RTF, PDF etc.  If however you are trying to interact with someone else's dodgy Excel setup (which often seems to be the case - i.e. "but I have this lovelly colored excel file that I want to put data into") then consider the problem reversed.  You can easily create a CSV file from the data.  Now that CSV file can easily be opened using VBA in the Excel users end, and done with as they like.  I mean is it really your responsibiliity what someone else does with a file provided?

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 594 views
  • 0 likes
  • 3 in conversation