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

#install.packages("readxl")
library(shiny)
library(readxl)

runApp(
  list(
    ui = fluidPage(
      titlePanel("Use readxl"),
      sidebarLayout(
        sidebarPanel(
          fileInput('file1', 'Choose xlsx file',
                    accept = c(".xlsx")
          )
        ),
        mainPanel(
          tableOutput('contents'))
      )
    ),
    server = function(input, output){
      output$contents <- renderTable({
        
        req(input$file1)
        
        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 (ycphs.github.io)

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 (r-project.org)

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 (r-bloggers.com)

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.