Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

177
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!