Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

175
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda