a11ytables
a11ytables copied to clipboard
Output to ODS
ODS files are the ideal output for publication, as indicated in the GOV.UK and GSS guidance.
Workbook-class objects created with {openxlsx} can't be written directly to ODS (?), you have to go with saveWorkbook()
in the first instance.
Perhaps provide guidance rather than functionality? I think all the styling and markup are lost if you try to read in an Excel file, then save out to ODS.
To note: this is something that the gptables team would also like to solve, but is also proving difficult in Python given the limits of the xlsx-related packages being wrapped.
At least for now, could we do something like:
system("libreoffice --headless --convert-to ods output-file.xlsx")
Which requires LibreOffice to be installed, of course.
Surely this is better than nothing?
Also suggested by Jan: https://github.com/JanMarvin/openxlsx2/discussions/574#discussioncomment-5552573
@DIPAD-Fran-Bryden pointed out a convert_to_ods()
function in {dftutils} (thank you!); could add documentation to {a11ytables} to suggest using this approach.
@matt-dray To note as well, we used to use Excel when we were running R locally; no longer relevant to DfT but may be of interest to people without a Cloud setup? Or anyone who loves a good bit of VBS... https://github.com/department-for-transport/odsconvertr/blob/main/R/save_files.R