Best way to export data as CSV or excel format?

Hi, I am trying to export data from the tracker capture and I am using ‘event reports’ as a ‘line list’ to do so. My first question is, What are the differences between the output type: enrollment and event?. Second of all, we have like 3000 patiens in the database, and for example if we want to show some dataelements inside the table, for 1 stage , the event reports generate 26 pages of data, and I have to download it 1 by 1 and then manually join then in 1 page. Is there any fastest way to take all data? Maybe some modules from app store that I can import or something. Thank you!

Hi @aitor_garrido,

Thank you for your post!

Please see this video presentation from Tracker Use Academy (URL at time of explanation):

The fastest would be to use the API and you will also be able to choose whether you want JSON, CSV, xls, or even gzip! Please see the docs: Tracker - Using the API | DHIS2 Documentation

Additionally, if you have the report ready in the Events Reports app then you can get the API request from the Network tab. I explain the process in video below but here are the written instructions too.

First, before you click on ‘update’, open the browser’s developers’ tools (F12) and then click on Network. You will see the Network tab empty at first. Second, click on the Update in the Event Reports app and you will see that a couple of requests were recorded in the Network tab. Look for the request that has query in it such as (https://play.dhis2.org/2.37.3/api/29/analytics/events/query/eBAyeGv0exc.json?dimension=pe:THIS_QUARTER;LAST_QUARTER&dimension=ou:ImspTQPwCqd&stage=Zj7UnCAulEk&displayProperty=NAME&outputType=EVENT&desc=eventdate&pageSize=100&page=1) . Third, copy the url and you can choose how many items to include by changing the pageSize parameter, and you can choose whether you want XML, JSON, CSV, or XLS by changing the format that appears before the question mark (‘?’) in the URL.

chrome_M30DaOmgBl

2 Likes

Hello @Gassim

Thank you much for the solution as I’ve been searching how to export event report from dhis2 to excel via data connection and it is working now due to your explanation.

If anyone who are a noob with api as myself and doesn’t know yet how to export data into excel from this url, pls go to Data >> Get Data >> From Web then put the url in excel . For me only with csv format is working.

2 Likes

Very happy that it worked for you too! And thank you for sharing this tip when using Excel. :pray:

1 Like