How simple is your spreadsheet ? Does it have merged cells, borders, colors, formulae, graphics, etc ?. If it doesn't try this program which should create a copy.Then either adapt it for your update or explain some more the problem you have.

#!perl use strict; use Spreadsheet::ParseXLSX; use Excel::Writer::XLSX; use Data::Dump 'pp'; my $file = 'c://temp//Book1'; my @data=(); read_file($file.'.xlsx'); #pp \@data; write_file($file.'_copied.xlsx'); sub read_file { my $file = shift; print "Reading $file\n"; my $parser = Spreadsheet::ParseXLSX->new(); my $wb1 = $parser->parse($file); if ( !defined $wb1 ) { die $parser->error(), ".\n"; } for my $n ( 1 .. $wb1->worksheet_count() ) { my $ws = $wb1->worksheet($n-1); my ( $row_min, $row_max ) = $ws->row_range(); my ( $col_min, $col_max ) = $ws->col_range(); my @tmp = (); for my $row ( $row_min .. $row_max ) { for my $col ( $col_min .. $col_max ) { my $cell = $ws->get_cell( $row, $col ); next unless $cell; push @tmp,join "\t",$row,$col,$cell->value(); } } my $name = $ws->get_name; print "Reading sheet $n $name\n"; push @data,[$name,\@tmp]; } } sub write_file { my $file = shift; print "Creating copy workbook $file\n"; my $wb2 = Excel::Writer::XLSX->new( $file ); for my $n (1..@data){ my $name = $data[$n-1][0]; my $ar = $data[$n-1][1]; print "Adding sheet $n $name\n"; my $ws = $wb2->add_worksheet($name); for (@$ar){ my ($row,$col,$value) = split "\t",$_; $ws->write( $row, $col, $value ); } } $wb2->close(); }
poj

In reply to Re^5: Delete entire row without using Win32::OLE by poj
in thread Delete entire row without using Win32::OLE by ravi45722

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.