Survey123 Tricks of the Trade: Download survey data (with attachments) (2024)

Do you want to download survey data, including photo attachments? This blog describes, step by step, how you you can do it.

Before we start

Before we start, let me point out that there are handy Export tools in the Survey123 website. They let you export your survey data as a CSV, Excel, KML, Shapefile or File Geodatabase. You can choose to export all your survey records, or just a subset.

Survey123 Tricks of the Trade: Download survey data (with attachments) (1)

You can also export your survey data from the item details page of your survey's layer item.

Survey123 Tricks of the Trade: Download survey data (with attachments) (2)

The only caveat with these export methods is that you can't download your photo attachments. Technically, you could get your images through the file geodatabase format, but what if you want to export your data and have all your photos in their original format in a folder? That's what this blog post is about.

It is going to take a Python script and ArcGIS Pro

Downloading your photos and documents in their original format requires a Python script and ArcGIS Pro. I will describe how to do it step-by-step. Even if you do not have experience with Python, you will be able to do this.

The Python script was developed by @ZacharySutherby Zach loves Python and he is always looking for new ideas to automate common Survey123 tasks. The script is part of the Survey123 developer documentation.

Download data and attachments

Survey123 Tricks of the Trade: Download survey data (with attachments) (3)

  • Click on the Download button and place the .ipynb file into a well-known location on your computer

Survey123 Tricks of the Trade: Download survey data (with attachments) (4)

  • Next, open a New project in ArcGIS Pro
  • In ArcGIS Pro, sign in to your ArcGIS Online or ArcGIS Enterprise organization, if not already
  • Open the View ribbon and make sure the Catalog Pane is visible

Survey123 Tricks of the Trade: Download survey data (with attachments) (5)

  • Open the Analysis ribbon, expand the Python menu and add a new Python Notebook.

Survey123 Tricks of the Trade: Download survey data (with attachments) (6)

  • From the Catalog pane, right click on the Notebooks category and click on Add Notebook

Survey123 Tricks of the Trade: Download survey data (with attachments) (7)

  • Use the Add Python Notebook dialog to browse for and select the .ipynb file you downloaded before

Survey123 Tricks of the Trade: Download survey data (with attachments) (8)

  • Double-click on the export_survey_data_with_attachments.ipynb notebook

Survey123 Tricks of the Trade: Download survey data (with attachments) (9)

At this point, the notebook will open. With a few minor changes it will be ready to run.

  • Scroll down until you see the second code cell, as shown in the screenshot below

Survey123 Tricks of the Trade: Download survey data (with attachments) (10)

  • Since you are already signed in, you can ignore the first three parameters (portalURL, username, password)
  • The survey_item_id uniquely identifies the survey for which you want to download data. Here is how you get the survey_item_id value:
    • In a web browser, sign in to survey123.arcgis.com
    • From the survey gallery, click on your survey
    • Get the survey ID as specified below

Survey123 Tricks of the Trade: Download survey data (with attachments) (11)

  • Now, take your survey_item_id and replace it in the Python code
  • Change the save_path parameter so it targets an existing directory in your own computer

Survey123 Tricks of the Trade: Download survey data (with attachments) (12)

Earlier, I asked you to disregard the portalURL, username and password parameters. If you ignored me and set those up, then you can skip the next instruction. If you left the portalURL, username and password parameters unchanged, then follow the next step

  • In the gis = GIS (portalURL, username, password) line, replace the contents within the brackets with "pro". That is, leave it as: gis = GIS ("pro"). This will essentially reuse the current login information within ArcGIS Pro to run this script and access your survey's data

Survey123 Tricks of the Trade: Download survey data (with attachments) (13)

  • You are now ready to run the script!
  • Open the Cell menu and click Run all

Survey123 Tricks of the Trade: Download survey data (with attachments) (14)

The script takes about 20 seconds to initialize. Be patient.

  • While the script runs, open the target folder and observe how data is downloaded.
    • You will see a spreadsheet created. It contains the records from your survey.
    • You will then see a second spreadsheet describing what attachments correspond to each record. Note that you could have multiple files (attachments) associated with one record.
    • Finally, a folder will be created for your attachments.The script will download photos, signatures as well as audio files any other type of document attached in this folder.

Survey123 Tricks of the Trade: Download survey data (with attachments) (15)

The script has a few other parameters that you can tweak. It is all superbly documented so I do not anticipate you will run into any issues with them.

More scripts

This is one of many scripts available through the Survey123 developer documentation. I encourage you to explore and play with other scripts. You will find samples to programmatically create reports, move surveys across organizations and more.

Many thanks to@ZacharySutherby and the Survey123 documentation team for their great work with this. If you have ideas for new scripts, post your comment below.

Survey123 Tricks of the Trade: Download survey data (with attachments) (2024)
Top Articles
Latest Posts
Article information

Author: Gov. Deandrea McKenzie

Last Updated:

Views: 6152

Rating: 4.6 / 5 (46 voted)

Reviews: 85% of readers found this page helpful

Author information

Name: Gov. Deandrea McKenzie

Birthday: 2001-01-17

Address: Suite 769 2454 Marsha Coves, Debbieton, MS 95002

Phone: +813077629322

Job: Real-Estate Executive

Hobby: Archery, Metal detecting, Kitesurfing, Genealogy, Kitesurfing, Calligraphy, Roller skating

Introduction: My name is Gov. Deandrea McKenzie, I am a spotless, clean, glamorous, sparkling, adventurous, nice, brainy person who loves writing and wants to share my knowledge and understanding with you.