Swechhya / excelR

An Interface to 'jExcel.js' Library
https://swechhya.github.io/excelR/
Other
152 stars 19 forks source link

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. #91

Open mengchen18 opened 3 years ago

mengchen18 commented 3 years ago

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!!!

Swechhya commented 3 years ago

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