co-analysis / a11ytables

R package: generate best-practice stats spreadsheets for publication
https://co-analysis.github.io/a11ytables/
Other
40 stars 3 forks source link

Output to ODS #46

Open matt-dray opened 2 years ago

matt-dray commented 2 years ago

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.

matt-dray commented 1 year ago

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.

matt-dray commented 1 year ago

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?

matt-dray commented 1 year ago

Also suggested by Jan: https://github.com/JanMarvin/openxlsx2/discussions/574#discussioncomment-5552573

matt-dray commented 7 months ago

@DIPAD-Fran-Bryden pointed out a convert_to_ods() function in {dftutils} (thank you!); could add documentation to {a11ytables} to suggest using this approach.

DIPAD-Fran-Bryden commented 7 months ago

@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