Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

176
Visualizações
How to save currency (in German format) and percentage columns as numeric in Excel after exportet from datatable in R shiny?

I want to export a datatable to Excel in R Shiny. For this purpose, I want to use the export button that is available in datatable. The table consists of columns formatted using formatCurrency(). Some of those columns contain a Euro-Symbol and some a percentage symbol.

However, these columns cause problems when the table is exported to Excel. In Excel, they are not numeric, but strings. But I want them to be numeric. That is, they should be arranged on the right and not on the left. But the format should not change.

Here is a an example that shows the problem:

library(shiny)
library(DT)

ui <- fluidPage(
  DTOutput("table")
)

server <- function(input, output, session) {
  output$table <- renderDT({
    datatable(mtcars * 1000, 
              rownames = FALSE, 
              extensions = "Buttons", 
              options = list(
                dom = "Bfrtip", 
                buttons = list(
                  list(
                    extend = "excel", 
                    text = "<i class='fa fa-file-excel-o'></i> Excel", 
                    filename = "Data", 
                    title = NULL
                  )
                )
              )
    ) %>% 
      formatCurrency(
        1:6, 
        currency = "\u20AC", 
        digits = 2, 
        mark = ".", 
        dec.mark = ",", 
        before = FALSE
      ) %>% 
      formatCurrency(
        7:11, 
        currency = "\u0025", 
        digits = 3, 
        mark = ".", 
        dec.mark = ",", 
        before = FALSE
      )
  })
}

shinyApp(ui, server)

Please let me know, if I need to deliver further information.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda