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

  • Home
  • SEARCH
  • 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 7697183
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T21:57:06+00:00 2026-05-31T21:57:06+00:00

I need to create an excel sheet with a field status. It is a

  • 0

I need to create an excel sheet with a field status. It is a drop down with values ‘High’, ‘Medium’, and ‘Low’. I need to show different colors when they select different values. I have implemented the drop down using writeexcel gem. Here is my code:

worksheet.data_validation(count, 5,
          {
            :validate        => 'list',
            :source          => ['High', 'Medium', 'Low'],
          })

The drop down is working fine. But I want to specify a color for each selection. I can color the cell based on the selection of the dropdown, but what I need is different colors for different selections of the drop down. Any other gem having this implementation is also fine.

  • 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-05-31T21:57:08+00:00Added an answer on May 31, 2026 at 9:57 pm

    The write_xlsx gem is an updated version of writeexcel that supports the newer Excel 2007+ XLSX format. It is by the same author and has the same interface but has additional features.

    One of these new features is Conditional Formating.

    You can use it to apply conditional formats to the same cell as the drop-down validation like this:

    worksheet.conditional_formatting(count, 5,
        {
            :type     => 'cell',
            :format   => format1,
            :criteria => '=',
            :value    => '"High"'
        }
    )
    
    worksheet.conditional_formatting(count, 5,
        {
            :type     => 'cell',
            :format   => format2,
            :criteria => '=',
            :value    => '"Medium"'
        }
    )
    ...
    

    You will need to define the formats using the standard interface.

    Note, write_xlsx is a port of the Perl module Excel::Writer::XLSX. That module contains additional documentation on the use of conditional formats. You should be able to convert the examples to Ruby easily enough.

    See also my answer to your previous question.

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

Sidebar

Related Questions

I have a Excel sheet with two columns and I need to create new
I need to create excel sheet from my Java code which contains charts like
I need to create an excel file via C#. I have read a few
I need to create an array from a list of data in excel. The
I've a requirement that I need to read an excel sheet programmatically using asp.net/C#
I'm using Visual Studio 2008 and I need create a DataTable from a Excel
I need to create a script that extracts some data from a complex Excel
My scenario is : I've an excel sheet. Some threads need to modify it
I have an excel spread sheet (well, hundreds of them) which I need importing
I need some gem/plugin to create an Excel spreadsheet with formulas to use in

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.