Search the knowledge base, browse our resources, and visit our forum for more detailed information
Last updated: 25 Nov 2025
The pulldata() function in XLSForm lets you dynamically retrieve information from an external CSV file while completing a form. This allows you to reference existing datasets and automatically pull in related details, avoiding the need for enumerators to re-enter the same information.
For example, you can use pulldata() to:
Auto-fill related information: When an ID, code, or key is entered, automatically retrieve linked details such as a name, category, or description.
Preload background data: Load information from external files so enumerators only need to collect new or updated data.
Using pulldata() helps reduce errors, saves time during data collection, and ensures that forms remain consistent with external reference datasets. This function is supported in both the KoboCollect Android app and Enketo web forms. We recommend using XLSForm to set up the pulldata() function.
This article covers the following steps for pulling data from an external CSV:
Setting up your external CSV
Setting up your XLSForm
Uploading your external CSV to KoboToolbox
To use pulldata(), first prepare an external CSV file containing the reference data you want to retrieve. Each row should represent a unique record (for example, a participant, location, or item) and the file should include at least two columns. One column must contain the index variable that matches the values entered in your form.
The index variable acts as the primary key that links your XLSForm to the external CSV. It should be a unique identifier that exists in both files, such as a participant ID, a district name, or another matching code.
The remaining columns can include any additional details you want to retrieve, such as names, categories, or descriptions. Ensure the CSV file is clean, consistently formatted, and saved with the .csv extension.
Once you have set up your external CSV, configure your XLSForm in the following way:
Ensure your XLSForm includes a question that serves as the index variable.
Add a calculate field to your survey. Give the field a name.
In the calculation column, use the pulldata() function to specify which field in the CSV to pull from. Use the following syntax: pulldata('csv','pull_from', 'csv_index', '${survey_index}').
csv is the name of the CSV file, without the extension.
pull_from refers to the column in your CSV file that contains the data you want to import into your form.
csv_index is the column in your CSV file that contains the index variable.
survey_index is the name of the question in your survey that contains the index variable.
survey worksheet
type |
name |
label |
calculation |
|---|---|---|---|
text |
respondent_id |
Respondent ID |
|
calculate |
eligibility_status |
pulldata(‘eligibility’, ‘status’, ‘ID’, ‘respondent_id’) |
|
note |
eligibility_not |
Respondent is ${eligibility_status} for the study. |
|
survey |
In the example above, the calculation retrieves the value from the status column of the eligibility.csv file, in the row where the ID in the CSV matches the ID entered in the respondent_id question of your form.
Note: After using the pulldata() function to retrieve external CSV data, you can reference that field in subsequent skip logic conditions, constraints, and labels, just like any other field or calculation.
The final step in linking your external CSV file to your form is uploading the file to KoboToolbox. To do this:
Navigate to your project SETTINGS, and open the Media tab.
Upload the CSV file(s) with the exact name you have used in your XLSForm.
Deploy or redeploy the form.

int() or number() functions to the retrieved value in your XLSForm.
' in front of the date to avoid automatic date formatting in Excel.
Did you find what you were looking for? Was the information clear? Was anything missing?
Share your feedback to help us improve this article!
KoboToolbox is maintained by Kobo Inc.