Auto Downloading ODK submission using R

Dear Developer

How to auto download ODK submission using R

Hi @ChamisaShaps

ruODK is your best solution


Can you share documentation also?


The ruODK package is probably the easiest way but you can also do:


url <- ""
r <- GET(url, authenticate("username", "password"))
text_content <- content(r, "text", encoding = "UTF-8")
json_content <- fromJSON(text_content,flatten = T)

This will get the submissions, if you have repeats then add ?%24expand=* to the end of the url to get all the data i.e
url <- "*"

1 Like

@Stuart thank you very much. That is what i was looking for exactly. I am still getting error when tried to run your scripts. Can i get in touch with you

This is Khine.
I would like to know if the "ruODK" or other R package works for encrypted data files.
Thanks. Khine

@Stuart i am facing the following challenge when i tried to use your scripts. What is the issue there

@ChamisaShaps wgat was the result from stop_for_status(r)? Have you changed the URL to your odk central server?

yes i have changed the url and inserted my credential. See the pic below again

ok so at the end of the url swap /submissons to .svc/Submissions

@Stuart how are you my boss. I failing to get the joy. I did what you instructed me to do but still failing

Hi, Looking at the error it seems to stem from your URL. I would surgest logining into central, opening the form selecting subbmissons and getting the url from the 'Analyze via OData' tab, copy that and it should solve the issue.

@Stuart finally we almost there . I have manged to run the code correct but when write view(df) am seeing the following results only while i am expecting to see all the columns (and rows) in the tool. What should i do. Do we need to converts data to data-frame or maybe there is a simple scripts for that

Ah yes a little closer, if you add /Submissions to the URl you'll get the data before the repeat if you add /Submissions?%24expand=* then you'll get all the data

@Stuart am back again . Thanks for be with me . I am kindly lost a bit . Below is the script that working and with that url. I cannot see the word submission on my url . See the below . Where to adjust or change to allow the scripts to display the whole data set.

try https:\xxxxxxxx.svc/Submissions or https:\xxxxxxxx.svc/Submissions?%24expand=*

Hi @Khine!

Welcome to the forum. If you have a moment, introduce yourself in the welcome thread! will work for encrypted forms. Central does not support access of individual encrypted records through OData or the Rest API.

1 Like

@Stuart finally we made it . Thank you very much and thank you very well

1 Like

No worries, happy to help