Sponsored Content
Top Forums Programming extract the same format from existing excel file using " Spreadsheet::ParseExcel " module Post 302592548 by kavi.mogu on Tuesday 24th of January 2012 08:35:04 AM
Old 01-24-2012
extract the same format from existing excel file using " Spreadsheet::ParseExcel " module

HTML Code:
Hi ,
can any one tell me,"How to extract the same format from existing excel file to new excel file " using Spreadsheet::WriteExcel or Spreadsheet::ParseExcel module ???

Example_pgm:

Below program is used to read existing excel file..In this program "my $cell        = $_[4];" line is used to extract the data from existing excel file..program have to extracting data along with its own format.....Is there any methods available for that?_________________________________________________________

#!/usr/bin/perl -w

    use strict;
    use Spreadsheet::ParseExcel;

    my $parser = Spreadsheet::ParseExcel->new(
        CellHandler => \&cell_handler,
        NotSetCell  => 1
    );

    my $workbook = $parser->parse('file.xls');

    sub cell_handler {

        my $workbook    = $_[0];
        my $sheet_index = $_[1];
        my $row         = $_[2];
        my $col         = $_[3];
        my $cell        = $_[4];

        # Skip some worksheets and rows (inefficiently).
        return if $sheet_index >= 3;
        return if $row >= 10;

        # Do something with the formatted cell value
        print $cell->value(), "\n";

    }
______________________________________________________________
Thanks,SmilieSmilie
kavi
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to include spreadsheet::ParseExcel in shell script

Please tell me that how can we include Spreadsheet::ParseExcel module in shell script (1 Reply)
Discussion started by: akash
1 Replies

2. Shell Programming and Scripting

Format output from the file to extract "date" section

Hello Team , I have to extract date section from the below file output. The output of the file is as shown below. I have to extract the "" this section from the above output of the file. can anyone please let me know how can we acheive this? (4 Replies)
Discussion started by: coolguyamy
4 Replies

3. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

4. Shell Programming and Scripting

error in "Spreadsheet/TieExcel.pm "

can any one tell me how to rectify the below error? :confused:Can't locate Spreadsheet/TieExcel.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.10.1 /usr/local/share/perl/5.10.1 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl .) (4 Replies)
Discussion started by: kavi.mogu
4 Replies

5. Shell Programming and Scripting

problem with "merge_range" in Spreadsheet::WriteExcel" module

Any one having idea that,How to copy merged cell from existing excel file to new excel file? Note : Is there any bug in module(Spreadsheet::WriteExcel or Spreadsheet::ParseExcel) itself ? Thanks, kavi (0 Replies)
Discussion started by: kavi.mogu
0 Replies

6. Shell Programming and Scripting

Can't locate Spreadsheet/ParseExcel

Hi I can't seem to figure out why i keep getting this error. the Spreadsheet::PhaseExcel is installed on 3 servers and is working on only 2... the last one it is installed exactly the same way but I keep getting this error. This is whats odd. If i run this script as a normal user i get... (2 Replies)
Discussion started by: vpundit
2 Replies

7. AIX

How to make existing volume group "shared"?

We have a 2 node cluster in which only the primary actually mounts the shared VGs at any specific time. We recently added a volume group to the primary. * The disks in it are visible to both nodes, but the secondary does not know about the new VG. * The new VG is not a "shared volume group" *... (10 Replies)
Discussion started by: ridgetop01
10 Replies

8. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

9. UNIX for Beginners Questions & Answers

Extract delta records using with "comm" and "sort" commands combination

Hi All, I have 2 pipe delimited files viz., file_old and file_new. I'm trying to compare these 2 files, and extract all the different rows between them into a new_file. comm -3 < sort file_old < sort file_new > new_file I am getting the below error: -ksh: sort: cannot open But if I do... (7 Replies)
Discussion started by: njny
7 Replies

10. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies
Spreadsheet::WriteExcel::Chart::Column(3pm)		User Contributed Perl Documentation	       Spreadsheet::WriteExcel::Chart::Column(3pm)

NAME
Column - A writer class for Excel Column charts. SYNOPSIS
To create a simple Excel file with a Column chart using Spreadsheet::WriteExcel: #!/usr/bin/perl -w use strict; use Spreadsheet::WriteExcel; my $workbook = Spreadsheet::WriteExcel->new( 'chart.xls' ); my $worksheet = $workbook->add_worksheet(); my $chart = $workbook->add_chart( type => 'column' ); # Configure the chart. $chart->add_series( categories => '=Sheet1!$A$2:$A$7', values => '=Sheet1!$B$2:$B$7', ); # Add the worksheet data the chart refers to. my $data = [ [ 'Category', 2, 3, 4, 5, 6, 7 ], [ 'Value', 1, 4, 5, 2, 1, 5 ], ]; $worksheet->write( 'A1', $data ); __END__ DESCRIPTION
This module implements Column charts for Spreadsheet::WriteExcel. The chart object is created via the Workbook "add_chart()" method: my $chart = $workbook->add_chart( type => 'column' ); Once the object is created it can be configured via the following methods that are common to all chart classes: $chart->add_series(); $chart->set_x_axis(); $chart->set_y_axis(); $chart->set_title(); These methods are explained in detail in Spreadsheet::WriteExcel::Chart. Class specific methods or settings, if any, are explained below. Column Chart Methods There aren't currently any column chart specific methods. See the TODO section of Spreadsheet::WriteExcel::Chart. EXAMPLE
Here is a complete example that demonstrates most of the available features when creating a chart. #!/usr/bin/perl -w use strict; use Spreadsheet::WriteExcel; my $workbook = Spreadsheet::WriteExcel->new( 'chart_column.xls' ); my $worksheet = $workbook->add_worksheet(); my $bold = $workbook->add_format( bold => 1 ); # Add the worksheet data that the charts will refer to. my $headings = [ 'Number', 'Sample 1', 'Sample 2' ]; my $data = [ [ 2, 3, 4, 5, 6, 7 ], [ 1, 4, 5, 2, 1, 5 ], [ 3, 6, 7, 5, 4, 3 ], ]; $worksheet->write( 'A1', $headings, $bold ); $worksheet->write( 'A2', $data ); # Create a new chart object. In this case an embedded chart. my $chart = $workbook->add_chart( type => 'column', embedded => 1 ); # Configure the first series. (Sample 1) $chart->add_series( name => 'Sample 1', categories => '=Sheet1!$A$2:$A$7', values => '=Sheet1!$B$2:$B$7', ); # Configure the second series. (Sample 2) $chart->add_series( name => 'Sample 2', categories => '=Sheet1!$A$2:$A$7', values => '=Sheet1!$C$2:$C$7', ); # Add a chart title and some axis labels. $chart->set_title ( name => 'Results of sample analysis' ); $chart->set_x_axis( name => 'Test number' ); $chart->set_y_axis( name => 'Sample length (cm)' ); # Insert the chart into the worksheet (with an offset). $worksheet->insert_chart( 'D2', $chart, 25, 10 ); __END__ AUTHOR
John McNamara jmcnamara@cpan.org COPYRIGHT
Copyright MM-MMX, John McNamara. All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself. perl v5.10.1 2010-02-02 Spreadsheet::WriteExcel::Chart::Column(3pm)
All times are GMT -4. The time now is 05:19 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy