Export protected Excel workbook using UNIX SAS

Occasional Learner
Posts: 1

Export protected Excel workbook using UNIX SAS

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!

Super User
Posts: 19,038

Re: Export protected Excel workbook using UNIX SAS

Unfortunately I don't think there's a way in Unix, I believe all the PC ways use the OS methods and possibly VB.
Super User
Super User
Posts: 7,691

Re: Export protected Excel workbook using UNIX SAS

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?

Ask a Question
Discussion stats
  • 2 replies
  • 3 in conversation