excelR icon indicating copy to clipboard operation
excelR copied to clipboard

In shiny app, when a column is deleted, the column header is not deleted accordingly. Results in an error when call "Excel_to_R" function.

Open mengchen18 opened this issue 4 years ago • 1 comments

This seems like a bug:

Describe the bug In shiny app, when a column is deleted, the column header is not deleted accordingly. Results in an error when call "Excel_to_R" function.

To Reproduce Steps to reproduce the behavior:

library(excelR)
library(shiny)

ui <- fluidPage(
  excelOutput("tab")
)

server <- function(input, output, session) {
  df <- data.frame(
    l = c("A", "B"),
    n = 1:2,
    stringsAsFactors = FALSE
  )
  output$tab <- renderExcel(
    excelTable(df)
  )
  
  observe(
    print(input$tab)
  )
}

shinyApp(ui, server)

Delete the second column from the shiny app, then the console prints:

$data
$data[[1]]
$data[[1]][[1]]
[1] "A"

$data[[2]]
$data[[2]][[1]]
[1] "B"

$col Headers
$colHeaders[[1]]
[1] "l"

$colHeaders[[2]]
[1] "n"

$colType
$colType[[1]]
[1] "text"

$forSelectedVals
[1] FALSE

Expected behavior Please note there are still two elements in the "colHeaders", it should return sth like this:

$data
$data[[1]]
$data[[1]][[1]]
[1] "A"

$data[[2]]
$data[[2]][[1]]
[1] "B"

$colHeaders
$colHeaders[[1]]
[1] "l"

$colType
$colType[[1]]
[1] "text"

$forSelectedVals
[1] FALSE

Thanks for you work!!! excelR is great!!!

mengchen18 avatar Mar 25 '21 10:03 mengchen18

@mengchen18 Can you please specify the version of excelR you are using? I can't replicate this issue in the latest development version.

Swechhya avatar Aug 19 '21 03:08 Swechhya