2

I write a dataframe in R to an excel file using the following command: write.xlsx(dataframe, pathName, row.names = FALSE, append = FALSE).

Now I want to print the first row (headers in the dataframe) in bold. Does anyone know how to do this with the write.xlsx function from the xlsx package?

bml
  • 115
  • 7
  • 1
    instead of writing your dataframe via the `write.xlsx` function, you can use the other resources of the xlsx package to create a workbook, set a font style [see here](https://www.rdocumentation.org/packages/xlsx/versions/0.5.7/topics/CellStyle) then write and close the workbook. – user2474226 Jan 23 '20 at 15:48

1 Answers1

0

You can use de write_xlsx function from the writexl package, setting format_headers = TRUE

write_xlsx(x, path = "your path", col_names = TRUE, format_headers = TRUE)
Diego Rojas
  • 199
  • 6