How to grab data into RShiny from excel based on cell color properties

We want to upload the file in shiny
But read only values based on cell color properties
(Cell background = white -> read value
else ignore)
How can we do it ?

Please find the template to read excel below
and screenshot of an excel :

enter image description here


    ui = fluidPage(
      titlePanel("Use readxl"),
          fileInput('file1', 'Choose xlsx file',
                    accept = c(".xlsx")
    server = function(input, output){
      output$contents <- renderTable({
        inFile <- input$file1
        read_excel(inFile$datapath, 1)

Perhaps you could use excel named ranges rather than colour coding. openxlsx provides functions to leverage that.
Get named regions — getNamedRegions • openxlsx (

Thanks for the idea. But this file keeps updating on regularly.
Therefore cell number keeps changing

how does it come to have the correct color in the correct places ?
can it not come to have correct named ranges ?

It is random and adjusted by management based on some measurement

reading between the lines, management can set colours, but can't do named ranges.
In that case, its opening a potential can of worms what with java dependencies, but the xlsx package, does have a function getCellStyle() you could try.
CRAN - Package xlsx (

Thanks for suggestion.
Not sure if I understand you.
Could you please share an example ?

A blog on the topic
When life gives you coloured cells, make categories | R-bloggers (