Stream: python

Topic: downloading a file by dataset DOI and filename


view this post on Zulip Ana Trisovic (Aug 18 2023 at 14:25):

Hi All,

I hope everyone is having a nice summer!
Are you aware of any resources for downloading a specific file from a specific version of a dataset from Dataverse?

So, as input I have a file name and a dataset version (and a DOI ofc); and using those two I want to download that file from that dataset version. To do that, I think I first need to get the fileID (from that version) and then to download it. So far, I am only able to explore the metadata of the latest dataset version, but not the previous versions (ie with dataset.json()[“data”][“latestVersion”][“files”]).

I was hoping I could do it with pyDataverse, but that is not really implemented https://pydataverse.readthedocs.io/en/latest/_modules/pyDataverse/api.html#NativeApi.get_dataset (it’s under TODO)

view this post on Zulip Jan Range (Aug 22 2023 at 10:35):

Ana Trisovic schrieb:

Hi All,

I hope everyone is having a nice summer!
Are you aware of any resources for downloading a specific file from a specific version of a dataset from Dataverse?

So, as input I have a file name and a dataset version (and a DOI ofc); and using those two I want to download that file from that dataset version. To do that, I think I first need to get the fileID (from that version) and then to download it. So far, I am only able to explore the metadata of the latest dataset version, but not the previous versions (ie with dataset.json()[“data”][“latestVersion”][“files”]).

I was hoping I could do it with pyDataverse, but that is not really implemented https://pydataverse.readthedocs.io/en/latest/_modules/pyDataverse/api.html#NativeApi.get_dataset (it’s under TODO)

Hi Ana,

indeed that is not yet an explicit function in pyDataverse, but it is possible with a bit of scripting. Please find attached a small script to fetch a file from a specific version.

fetch_file_by_version.py


Last updated: Nov 01 2025 at 14:11 UTC