Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7924333
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T17:42:28+00:00 2026-06-03T17:42:28+00:00

My Perl script is generating an excel sheet. Output P MON #N/A XML xx

  • 0

My Perl script is generating an excel sheet.

Output

P   MON #N/A    XML                 xx  ##  c   2   Yes                                         
B   TUE #N/A    TXT                 xx  ##  b   1   No                                          
D   SUN #N/A    EXE                 xx  ##  a   1   No                                          

I want the excel sheet’s column to be highlighted in different colours

I followed this site

But I am not getting any idea to set different colours for different columns using Perl .

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T17:42:29+00:00Added an answer on June 3, 2026 at 5:42 pm

    You need to use the set_column() method with a format object that has the bg_color set. Here is a small working example.

    #!/usr/bin/perl
    
    use strict;
    use warnings;
    use Spreadsheet::WriteExcel;
    
    my $workbook  = Spreadsheet::WriteExcel->new( 'columns.xls' );
    my $worksheet = $workbook->add_worksheet();
    
    # Add some formats with background colors.
    my $format1   = $workbook->add_format( bg_color => 'yellow' );
    my $format2   = $workbook->add_format( bg_color => 0x32 );
    
    # Format column A with a background color of yellow.
    $worksheet->set_column('A:A', undef, $format1);
    
    # Format column c with a new width and light green.
    $worksheet->set_column('C:C', 30, $format2);
    
    
    # Add some data to the worksheet.
    my $headings = [ 'Column 1', 'Column 2', 'Column 3' ];
    my $data = [
        [ 2, 3, 4, 5, 6, 7 ],
        [ 1, 4, 5, 2, 1, 5 ],
        [ 3, 6, 7, 5, 4, 3 ],
    ];
    
    $worksheet->write( 'A1', $headings );
    $worksheet->write( 'A2', $data );
    
    __END__
    

    Which gives you output like this:

    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am generating new xml file using perl script but I have small problem,
I'm generating a large XML document via a Perl script in a command window,
I'm generating a node.js script inside a Perl program, and I want to run
I want my perl script to correctly parse two command line arguments separated by
I am writing a perl script. I want to filter out lines that do
I have a perl script which calls another perl script using backticks. I want
perl script.pl --f1=t1 --f2=t2 --f3=t4 --f4 < /home/joe/a.txt script.pl use Getopt::Long; my ($f1, $f2,
Perl script needs to receive ajax request, send a success message back to browser,
I have a Perl script that uses WWW::Mechanize to read from a file and
I have a Perl script called replaceUp: #!/usr/bin/perl search=$1 replace=$2 find . -type f

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.