Auto download and rename, the data collected using odk collect

Can we download the photographs automatically from the link?

For example: I have attached my excel. I need to download the google drive link automatically and the file name should rename to the custom name which I want. This is the sample data I need to do this for larger files.

Is there any queries to download ?

If there are any methods please share with me. sample-odk forum.xlsx (12.2 KB)

Hello @Thalavaipandi,

It's kind of hard to help you because you didn't give us so much to go on here. For starters, are you able to write code? If you are, which language do you often use? I am certain the many power users here will be able to get you on the right path with a little more help.

That said, I'll throw in this to at least help the situation a bit. cURL, used below, is cross platform so it should work regardless. You can have a program or script that obtains the data in the data-treedetails-observations-image column and truncates the part after ?id=
So for the first record in the file you attached, you will need to extract 1jog99LeRijRhpLv0eu3cch8jsok0-Xwc from https://drive.google.com/open?id=1jog99LeRijRhpLv0eu3cch8jsok0-Xwc

The next step is to open up terminal or command prompt and use

curl -L -o [desiredName] "https://drive.google.com/uc?export=download&id=[fileID]"

making sure to replace [desiredName] with the custom name and [fileID] with the string you extracted in the previous step. So to download the first record to your device and renamed to image3.jpg you will need to use

curl -L -o image3.jpg "https://drive.google.com/uc?export=download&id=1jog99LeRijRhpLv0eu3cch8jsok0-Xwc"

For files greater than 40MB though, you may need to consult this post.

1 Like