Python samples

You can automate data capture workflows using the ArcGIS API for PythonSurvey123 module. With this module, you can identify properties of surveys, download your survey results, display survey results in a Pandas data frame, create reports, and manage report templates. Other modules in ArcGIS API for Python also allow you to share your surveys, link content to your surveys, clone surveys between organizations, and work directly with their underlying feature services.

The following samples demonstrate features of the ArcGIS API for PythonSurvey123 module, as well as automation workflows to help you expedite Survey123 tasks. The samples show how to use Python to accomplish many tasks, such as automating report generation, updating the contents of the Survey123 media folder, and cloning surveys from one organization to another. Most samples are in the form of a Jupyter Notebook that can be viewed online or downloaded and run interactively. Some samples are provided as stand-alone Survey123 scripts that should be downloaded directly from the Survey123-tools repository.

Download and run the samples

Go to the Survey123-tools repository and clone the repository to run the notebooks locally on your computer. You will also need the ArcGIS API for Python installed on your computer. To learn more, see Install and set up.

Alternatively, you can run the samples in ArcGIS Notebooks by clicking the Try it live link on each of the following pages in this guide. If you are signed in to your ArcGIS account and have ArcGIS Notebooks privileges assigned, you can Open Notebook directly in your browser. If you are not signed in you can Download the notebook only.

Get started with the Survey123 module

The Survey123 module allows you to connect to your surveys so that you can perform operations. To connect to a survey, complete the following:

  1. Sign in to your ArcGIS organization by running the following command in either a Python script or Python console:

    Use dark colors for code blocks
     
    1
    gis = arcgis.gis.GIS("https://arcgis.com", "<username>", "<password>")
  2. Define a Survey Manager, which will contain all available survey projects and their item information and properties.

    Use dark colors for code blocks
     
    1
    survey_manager = arcgis.apps.survey123.SurveyManager(gis)

    To learn more, see Work with the Survey Manager.

With a Survey Manager defined, you can now analyze, report on, and access data of all the available surveys.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.