Apply Password to already Written XLS File.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Apply Password to already Written XLS File.
# 1  
Old 07-14-2010
Apply Password to already Written XLS File.

I need to apply password protection to a xls file.I had looked at SpreadSheet::WriteExcel but problem being i dont want to write the contents of file again as the formatting the file would be a pain.

Is there way in which i write a entire file in one go , something like this

Code:
$sp->write(XLSFile);

and then just apply the
Code:
$sp->protect('password');



---------- Post updated 07-14-10 at 09:31 AM ---------- Previous update was 07-13-10 at 05:32 PM ----------

Anyone ?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Merging Multiple XLS into Different tabs in xls/ xlsx

HI, I have multiple files per dept in folder for eg : In a folder File1_Dept100.xls File2_Dept100.xls File3_Dept100.xls File1_Dept200.xls File2_Dept200.xls File3_Dept200.xls Output should be : Dept100.xls which has File1, File2, File3 in different tabs Dept200.xls which has... (1 Reply)
Discussion started by: venkyzrocks
1 Replies

2. Shell Programming and Scripting

Apply file permission

Hi All, I would like to read the permission from a file and wanted to apply the same permission to another file. say for example, f1 755 first...i have to read the permission type (which is differ for each file) and need to apply the same for f2 a1 666 i have to get this... (5 Replies)
Discussion started by: karthi_mrkg
5 Replies

3. UNIX for Advanced & Expert Users

How to copy a binary file while the file is being written to by another process

Hello, Can I copy a binary file while the file is being written to by another process? Another process (program) “P1” creates and opens (for writing) binary file “ABC” on local disk. Process P1 continuously write into ABC file every couple of seconds, adding 512-byte blocks of data. ABC file... (1 Reply)
Discussion started by: mbuki
1 Replies

4. UNIX for Advanced & Expert Users

ldapsearch in monitoring script without bind password written in script

Hi I do a very simple monitoring of our OpenLDAP (runs in cronjob and generate alerts if unsuccessfull) $ ldapsearch -h hostname.domain -D "cn=monitor_user,ou=People,dc=organisation" -w "password" -b "dc=organisation" -x "(&(cn=monitor_user)(ou=People))" dn | grep -v version dn:... (4 Replies)
Discussion started by: slashdotweenie
4 Replies

5. UNIX for Dummies Questions & Answers

12. If an ‘88’ Record with BAI Code ‘902’ was found on input file and not written to Output file, re

This is my input file like this 03,105581,,015,+00000416418,,,901,+00000000148,,,922,+00000000354,,/ 49,+00000000000416920,00002/ 03,5313236,,015,+00231036992,,,045,+00231036992,,,901,+00000048428,,/ 88,100,+0000000000000,0000000,,400,+0000000000000,0000000,/ 88,902,+0000000079077,,/... (0 Replies)
Discussion started by: sgoud
0 Replies

6. Shell Programming and Scripting

Re-apply the file permission

Hi, I having an issue with file permission. To fix it I need to read the file's existing permission and re-apply the same permission to the file. This has to be done for every single file under a mount point. I'm novice in scripting. Help me with this in shell scripting. # ls -l /dev/null... (10 Replies)
Discussion started by: agent001
10 Replies

7. Solaris

Apply password in some command

hello guys, I need some command,script or anythng which will help me to prompt for a password if I give some common unix command. We need this command to restrict the access to few users only like for tip command. That wenever i give TIP command, it will ask for password and only autherized users... (1 Reply)
Discussion started by: harpreetrekhi
1 Replies

8. Shell Programming and Scripting

converting xls file to txt file and xls to csv

I need to convert an excel file into a text file and an excel file into a CSV file.. any code to do that is appreciated thanks (6 Replies)
Discussion started by: bandar007
6 Replies

9. Shell Programming and Scripting

Checking a file is not being written to

Hello All I am attempting to write a shell script (bourne shell script) which will copy a tar'd and compressed file from a directory to a staging area but will not know whether the file is still open for write since files are being ftp's to my site at random times during the day. Once I am... (14 Replies)
Discussion started by: kanejm
14 Replies

10. UNIX for Dummies Questions & Answers

File being used/written

Hello, Which command in unix can tell whether a file is being used/written by another process. e.g. If one process is copying a very big file in some directory and there is another cronjob process which checks for a new file and in this directory and process the file. I want to check, if the... (4 Replies)
Discussion started by: sanjay92
4 Replies
Login or Register to Ask a Question
Excel::Template(3pm)					User Contributed Perl Documentation				      Excel::Template(3pm)

NAME
Excel::Template - Excel::Template SYNOPSIS
First, make a template. This is an XML file, describing the layout of the spreadsheet. For example, test.xml: <workbook> <worksheet name="tester"> <cell text="$HOME" /> <cell text="$PATH" /> </worksheet> </workbook> Now, create a small program to use it: #!/usr/bin/perl -w use strict; use Excel::Template; # Create the Excel template my $template = Excel::Template->new( filename => 'test.xml', ); # Add a few parameters $template->param( HOME => $ENV{HOME}, PATH => $ENV{PATH}, ); $template->write_file('test.xls'); If everything worked, then you should have a spreadsheet called text.xls in your working directory that looks something like: A B C +----------------+----------------+---------------- 1 | /home/me | /bin:/usr/bin | +----------------+----------------+---------------- 2 | | | +----------------+----------------+---------------- 3 | | | DESCRIPTION
This is a module used for templating Excel files. Its genesis came from the need to use the same datastructure as HTML::Template, but provide Excel files instead. The existing modules don't do the trick, as they require replication of logic that's already been done within HTML::Template. MOTIVATION
I do a lot of Perl/CGI for reporting purposes. In nearly every place I've been, I've been asked for HTML, PDF, and Excel. HTML::Template provides the first, and PDF::Template does the second pretty well. But, generating Excel was the sticking point. I already had the data structure for the other templating modules, but I just didn't have an easy mechanism to get that data structure into an XLS file. USAGE
new() This creates a Excel::Template object. Parameters o FILE / FILENAME Excel::Template will parse the template in the given file or filehandle automatically. (You can also use the parse() method, described below.) If you want to use the __DATA__ section, you can do so by passing FILE => *DATA o RENDERER The default rendering engine is Spreadsheet::WriteExcel. You may, if you choose, change that to another choice. The legal values are: o Excel::Template->RENDER_NML This is the default of Spreadsheet::WriteExcel. o Excel::Template->RENDER_BIG This attempts to load Spreadsheet::WriteExcel::Big. o Excel::Template->RENDER_XML This attempts to load Spreadsheet::WriteExcelXML. o USE_UNICODE This will use Unicode::String to represent strings instead of Perl's internal string handling. You must already have Unicode::String installed on your system. The USE_UNICODE parameter will be ignored if you are using Perl 5.8 or higher as Perl's internal string handling is unicode-aware. NOTE: Certain older versions of OLE::Storage_Lite and mod_perl clash for some reason. Upgrading to the latest version of OLE::Storage_Lite should fix the problem. Deprecated o BIG_FILE Instead, use RENDERER => Excel::Template->RENDER_BIG param() This method is exactly like HTML::Template's param() method. parse() / parse_xml() This method actually parses the template file. It can either be called separately or through the new() call. It will die() if it runs into a situation it cannot handle. If a filename is passed in (vs. a filehandle), the directory name will be passed in to XML::Parser as the Base parameter. This will allow for XML directives to work as expected. write_file() Create the Excel file and write it to the specified filename, if possible. (This is when the actual merging of the template and the parameters occurs.) output() It will act just like HTML::Template's output() method, returning the resultant file as a stream, usually for output to the web. (This is when the actual merging of the template and the parameters occurs.) register() This allows you to register a class as handling a node. q.v. Excel::Template::Factory for more info. SUPPORTED NODES
This is a partial list of nodes. See the other classes in this distro for more details on specific parameters and the like. Every node can set the ROW and COL parameters. These are the actual ROW/COL values that the next CELL-type tag will write into. o WORKBOOK This is the node representing the workbook. It is the parent for all other nodes. o WORKSHEET This is the node representing a given worksheet. o IF This node represents a conditional expression. Its children may or may not be rendered. It behaves just like HTML::Template's TMPL_IF. o LOOP This node represents a loop. It behaves just like HTML::Template's TMPL_LOOP. o ROW This node represents a row of data. This is the 1 in A1. There is no COLUMN node, as of yet. o FORMAT This node varies the format for its children. All formatting options supported in Spreadsheet::WriteExcel are supported here. There are also a number of formatting shortcuts, such as BOLD and ITALIC. o BACKREF This refers back to a cell previously named. o CELL This is the actual cell in a spreadsheet. o FORMULA This is a formula in a spreadsheet. o RANGE This is a BACKREF for a number of identically-named cells. o VAR This is a variable. It is generally used when the 'text' attribute isn't sufficient. BUGS
None, that I know of. SUPPORT
This is production quality software, used in several production web applications. MAINTAINERS
Jens Gassmann <jegade@cpan.org> Robert Bohne <rbo@cpan.org> Rob Kinyon <rkinyon@cpan.org> CONTRIBUTORS
There is a mailing list at http://groups.google.com/group/ExcelTemplate or exceltemplate@googlegroups.com Robert Bohne <rbo@cpan.org> o Swichting to Module::Install o Add autofilter to worksheet Robert Graff o Finishing formats o Fixing several bugs in worksheet naming Jens Gassmann o Add hide_gridlines to worksheet TEST COVERAGE
I use Devel::Cover to test the coverage of my tests. Every release, I intend to improve these numbers. Excel::Template is also part of the CPAN Kwalitee initiative, being one of the top 100 non-core modules downloaded from CPAN. If you wish to help out, please feel free to contribute tests, patches, and/or suggestions. ---------------------------- ------ ------ ------ ------ ------ ------ ------ File stmt bran cond sub pod time total ---------------------------- ------ ------ ------ ------ ------ ------ ------ blib/lib/Excel/Template.pm 93.8 60.0 58.8 100.0 100.0 31.8 83.3 ...ib/Excel/Template/Base.pm 94.4 50.0 n/a 100.0 0.0 4.4 80.0 ...cel/Template/Container.pm 100.0 50.0 33.3 100.0 0.0 2.0 83.3 ...emplate/Container/Bold.pm 100.0 n/a n/a 100.0 0.0 0.1 95.0 .../Container/Conditional.pm 95.9 90.0 66.7 100.0 0.0 0.3 91.0 ...plate/Container/Format.pm 100.0 n/a n/a 100.0 0.0 1.5 96.8 ...plate/Container/Hidden.pm 100.0 n/a n/a 100.0 0.0 0.0 95.0 ...plate/Container/Italic.pm 100.0 n/a n/a 100.0 0.0 0.0 95.0 ...ainer/KeepLeadingZeros.pm 100.0 100.0 n/a 100.0 0.0 0.0 96.3 ...plate/Container/Locked.pm 100.0 n/a n/a 100.0 0.0 0.0 95.0 ...emplate/Container/Loop.pm 96.8 50.0 50.0 100.0 0.0 0.1 82.7 ...late/Container/Outline.pm 100.0 n/a n/a 100.0 0.0 0.0 95.0 ...Template/Container/Row.pm 100.0 75.0 n/a 100.0 0.0 0.1 90.6 ...mplate/Container/Scope.pm 100.0 n/a n/a 100.0 n/a 0.0 100.0 ...plate/Container/Shadow.pm 100.0 n/a n/a 100.0 0.0 0.0 95.0 ...te/Container/Strikeout.pm 100.0 n/a n/a 100.0 0.0 0.0 95.0 ...ate/Container/Workbook.pm 100.0 n/a n/a 100.0 n/a 7.0 100.0 ...te/Container/Worksheet.pm 95.5 87.5 100.0 100.0 0.0 1.1 90.2 ...Excel/Template/Context.pm 98.0 80.0 75.0 100.0 73.3 17.0 90.7 ...Excel/Template/Element.pm 100.0 n/a n/a 100.0 n/a 0.1 100.0 ...mplate/Element/Backref.pm 100.0 50.0 33.3 100.0 0.0 0.1 87.1 .../Template/Element/Cell.pm 97.9 75.0 80.0 100.0 0.0 5.6 88.6 ...mplate/Element/Formula.pm 100.0 n/a n/a 100.0 0.0 0.0 94.1 ...te/Element/FreezePanes.pm 100.0 n/a n/a 100.0 0.0 0.0 95.5 ...Template/Element/Image.pm 100.0 100.0 n/a 100.0 0.0 0.0 94.3 ...Template/Element/Range.pm 100.0 66.7 n/a 100.0 0.0 0.1 88.9 ...l/Template/Element/Var.pm 100.0 n/a n/a 100.0 0.0 0.0 94.1 ...Excel/Template/Factory.pm 100.0 73.1 66.7 100.0 100.0 22.3 91.4 .../Excel/Template/Format.pm 98.4 75.0 33.3 100.0 66.7 2.6 90.5 ...xcel/Template/Iterator.pm 98.6 80.0 70.6 100.0 50.0 0.3 88.8 ...el/Template/TextObject.pm 92.9 62.5 33.3 100.0 0.0 3.3 80.9 Total 97.8 74.7 64.6 100.0 35.7 100.0 89.4 ---------------------------- ------ ------ ------ ------ ------ ------ ------ COPYRIGHT
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of the license can be found in the LICENSE file included with this module. SEE ALSO
perl(1), HTML::Template, Spreadsheet::WriteExcel perl v5.14.2 2012-04-29 Excel::Template(3pm)