Problem when creating an XLSForm using R


I want to create a new excel form from R that will be imported on the API. When I create an excel file using the “xlsx” or “openxlsx” packages, the form is not valid when I test it on: ODK - XLSForm Online v2.x

I get this error: Error: The survey sheet is either empty or missing important column headers.

However, if I open this same form with Excel and just click on save, the form becomes valid.

I also tried to change the encoding of my R script but it did not work.

Do you have any idea what my problem is?

Welcome to the community, @cmn! Maybe you have missed some elements from the XLSForm. This site should also help you check if you have missed any?

@Kal_Lam Thank you very much for your answer! I don’t think I forgot anything, when I open the two documents in Excel (the document generated by R which is invalid and the document generated by R and then saved in Excel which is valid), their content is identical.

@cmn, let’s see if the community should have any advice here.

Hello, after a lot of research, I found the writexl package which works to have a valid form.


@cmn, thank you for sharing this with the community! Maybe sharing the link of the same with the community should also help other users solve their issues if they happen to face them in the future.