01-05-2016 03:29 PM
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).
01-06-2016 04:57 AM
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?