http://qs321.pair.com?node_id=11138065


in reply to Editing an existing excel

You can't edit an Excel file using Excel::Writer::XLSX - you can only create a new empty one and write to it. You can read an existing file using Spreadsheet::ParseXLSX but again, you can't edit.

You can create charts using Excel::Writer::XLSX (see Excel::Writer::XLSX::Chart) but I can't see a histogram there, only bar charts.

Replies are listed 'Best First'.
Re^2: Editing an existing excel
by thonny (Initiate) on Oct 26, 2021 at 14:35 UTC
    Yes. My first attempt was to edit the existing excel file. When I failed to do so, I tried to generate histogram with the Perl script itself but I couldnt find way to plot histogram.

      Plotting a histogram with Perl can be achieved using GD::Graph::histogram or via Chart::Gnuplot. I will demonstrate the latter since the former already has a demo.

      use Chart::Gnuplot; my @counts = (10,11,20,5,13,19); my @labels = ('a'..'f'); my $dataSet = Chart::Gnuplot::DataSet->new( xdata => \@labels, ydata => \@counts, title => "Histogram", style => "histograms", ); # Create chart object and specify the properties of the chart my $chart = Chart::Gnuplot->new( title => "Simple testing", xlabel => "My x-axis label", ylabel => "My y-axis label", # this dumbs an ASCII histogram to console #terminal => 'dumb', # this plots it as a PNG output => 'x.png', terminal => 'png', ); # Plot the data set on the chart $chart->plot2d($dataSet);

      bw, bliako

        I am getting this error "Can't locate Chart/Gnuplot.pm in @INC". I tried installing but I keep getting
        Fetching with LWP: ftp://ftp.perl.org/pub/CPAN/authors/01mailrc.txt.gz LWP failed with code[500] message[LWP::Protocol::MyFTP: connect: Conne +ction timed out] Fetching with Net::FTP: ftp://ftp.perl.org/pub/CPAN/authors/01mailrc.txt.gz Trying with "/usr/intel/bin/wget -O -" to get ftp://ftp.perl.org/pub/CPAN/authors/01mailrc.txt.gz --2021-10-26 23:53:56-- ftp://ftp.perl.org/pub/CPAN/authors/01mailrc. +txt.gz => ‘-’ Resolving ftp.perl.org (ftp.perl.org)... 203.178.137.175 Connecting to ftp.perl.org (ftp.perl.org)|203.178.137.175|:21... faile +d: Connection timed out. Retrying. --2021-10-26 23:56:09-- ftp://ftp.perl.org/pub/CPAN/authors/01mailrc. +txt.gz (try: 2) => ‘-’ Connecting to ftp.perl.org (ftp.perl.org)|203.178.137.175|:21... faile +d: Connection timed out. Retrying. --2021-10-26 23:58:21-- ftp://ftp.perl.org/pub/CPAN/authors/01mailrc. +txt.gz (try: 3) => ‘-’ Connecting to ftp.perl.org (ftp.perl.org)|203.178.137.175|:21... faile +d: Connection timed out. Retrying. --2021-10-27 00:00:35-- ftp://ftp.perl.org/pub/CPAN/authors/01mailrc. +txt.gz (try: 4) => ‘-’ Connecting to ftp.perl.org (ftp.perl.org)|203.178.137.175|:21... faile +d: Connection timed out. Retrying.
Re^2: Editing an existing excel
by LanX (Saint) on Oct 26, 2021 at 14:02 UTC
    Question: Is it possible to add new sheets to an existing Excel file?

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery