Visit Our UNIX and Linux User Community


Perl script to create/write into spreadsheet


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Perl script to create/write into spreadsheet
# 1  
Old 08-14-2013
Perl script to create/write into spreadsheet

Hi,

I need help in debug following script. can somebody help....!!!

Code:
#!/usr/bin/perl -w

use strict;
use Spreadsheet::WriteExcel;

# Create a new workbook called simple.xls and add a worksheet.
my $workbook  = Spreadsheet::WriteExcel->new('simple.xls');
my $worksheet = $workbook->add_worksheet();

# The general syntax is write($row, $column, $token).
# Note that row and column are zero indexed.

# Write some text.
$worksheet->write(0, 0,  'Hi Excel!');


# Write some numbers.
$worksheet->write(2, 0,  3);          # Writes 3
$worksheet->write(3, 0,  3.00000);    # Writes 3
$worksheet->write(4, 0,  3.00001);    # Writes 3.00001
$worksheet->write(5, 0,  3.14159);    # An approximation


# Write some formulas.
$worksheet->write(7, 0,  '=A3 + A6');
$worksheet->write(8, 0,  '=IF(A5>3,"Yes", "No")');


# Write a hyperlink.
$worksheet->write(10, 0, '"http://www.perl.com/"

__END__

above perl code fails to create new spreadsheet and write into it.

following error i am seeing while i try to execute the above script.

PHP Code:
Can't locate Spreadsheet/WriteExcel.pm in @INC (@INC contains: /usr/lib64/perl5/5.8.5/x86_64-linux-thread-multi /usr/lib/perl5/5.8.5 /usr/lib64/perl5/site_perl/5.8.5/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.8.5 /usr/lib/perl5/site_perl /usr/lib64/perl5/vendor_perl/5.8.5/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.5 /usr/lib64/perl5/vendor_perl/5.8.3/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl .) at ./gen_output.pl line 4.
BEGIN failed--compilation aborted at ./gen_output.pl line 4. 
Rgds,
ravi.
# 2  
Old 08-14-2013
install the
Code:
Spreadsheet::WriteExcel


Previous Thread | Next Thread
Test Your Knowledge in Computers #763
Difficulty: Medium
L4 caches are currently very common in computer systems.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need a perl script to read and write the data

Hi, I have on Designdocument in that information is stored with in tabular format.I need Perlscript to read and write the datausing perl script? Regards, Ravi (0 Replies)
Discussion started by: toravi.pentaho
0 Replies

2. Shell Programming and Scripting

Unable to create spreadsheet in cgi script

hi folks, I am trying to download xlsx from cgi page in browser but not sure where I made a mistake. the cgi script contains the code for creating xlsx and just by clicking on the image I should be able to #!/usr/bin/perl -w use Excel::Writer::XLSX; use DBI; use DBD::mysql; use CGI;... (1 Reply)
Discussion started by: scriptscript
1 Replies

3. Shell Programming and Scripting

How to write a update query in perl script?

can any one suggest me on how to write a update query in perl script for Oracle database and also tell me abt how we can write a code for sending mails with report as attachment to appropriate persons? (1 Reply)
Discussion started by: Ramesh V Kumar
1 Replies

4. Shell Programming and Scripting

perl script to find, write, repeat...

I am a novice writing perl scripts so I'd appreciate any help you guys can offer. I have a list of 100 words in a file (words.txt) and I need to find them in a second file (data.txt). Whenever one of these words is found I need to write that line to a third file (out.txt) and then continue... (1 Reply)
Discussion started by: tgamble
1 Replies

5. Shell Programming and Scripting

Using Spreadsheet on Perl in UNIX

Very new to UNIX, so still getting used to all this. I made a Perl script where I want to create a spreadsheet file when extracting "data" from a text file. Now, this works perfectly fine on my Windows OS since I'm using the Win32 libraries with Microsoft Excel, but when I want to try it out on... (0 Replies)
Discussion started by: kooshi
0 Replies

6. UNIX for Dummies Questions & Answers

Create a shell script for write files with 2 parameters

Hello, I'm a newbie in shell script. So, i would like to create a shell script which take 2 IN parameters (PARAM1 and PARAM2). This script need to create 2 files as : I need to create this file /etc/apache2/sites-available/PARAM2 : <VirtualHost *:80> DocumentRoot "/home/PARAM1/www"... (0 Replies)
Discussion started by: chatlumo
0 Replies

7. Shell Programming and Scripting

To write a shell script which groups files with certain pattern, create a tar and zip

Hi Guru's, I have to write a shell script which groups file names based upon the certain matching string pattern, then creates the Tar file for that particular group of files and then zips the Tar file created for the respective group of files. For example, In the given directory these files... (3 Replies)
Discussion started by: rahu_sg
3 Replies

8. UNIX for Dummies Questions & Answers

how to write script to create directory

Please help. I am the beginner. Don't understand about archive file. How to create a directory for the files from each archive with name of directory which equivalent to the base name of the archive. eg I have file abc.txt. How can I create a directory name abc. Thank you (1 Reply)
Discussion started by: snail
1 Replies

9. Shell Programming and Scripting

Need help to write a Perl script

Hello friends, I am having a awk script which does my goal , but I want to learn perl , after learning the basics in perl now I am trying to convert my nawk script to perl . Please help me to do some task in perl that I ve already did in nawk. Like I am facing some problem in... (10 Replies)
Discussion started by: user_prady
10 Replies

10. UNIX for Advanced & Expert Users

how i write script to create 30 processes

helo i make one process for com port . in that i create two thread one for reading data and another for writing data to com port. now i want to write a script which create 30 processes for handling 30 com port. is it good solution for handling 30 com port. Thx & Regards, Amit (2 Replies)
Discussion started by: amitpansuria
2 Replies

Featured Tech Videos