Since openxlsx is not actively maintained anymore, openxlsx2 has a function to write to Excel https://janmarvin.github.io/openxlsx2/reference/write_xlsx.html