Manage content in the user workspace

In the notebook editor, you can work with content in a workspace in your ArcGIS Online organization to add files to your notebook or download them to your machine. Click the Files button to open the Files pane. You can also work with files by going to the Notebook tab, clicking the Manage button, and clicking Manage files.

Browse content in the workspace

The Files pane provides a browser for the files in your workspace. The default folders are home and samplesdata (the latter for the data used in the sample notebooks). The Manage files page provides a browser for all your files in the home folder where you can create folders, upload files, and delete and rename content.

Upload content to the workspace

To work with content and resources from your machine, you must first upload your file to your notebook's workspace through the notebook editor or on the Manage files page. Once your files are uploaded, you can reference their file path in an open notebook and any other notebooks you own with filepath = /arcgis/home/folder/filename.

To upload files through the notebook editor, complete the following steps:

  1. In the Files pane, browse to the /arcgis/home folder.

    Note:
    /arcgis/home is the workspace directory and is different from the root directory home/arcgis.

  2. Optionally, click New folder to create a folder in the /arcgis/home workspace where you will upload content.
  3. Click Choose file to upload and browse to the file.
  4. Select the file.

    The file is uploaded to the workspace.

To upload files on the Manage files page, complete the following steps:
  1. Go to your Notebook tab, click the Manage button, and click Manage files.
  2. Click the Upload file button Upload.
  3. Drag and drop the file from your machine to the New Items window, or click the your device button to navigate to a file on your machine.

    The file is uploaded to the workspace.

Files that are uploaded to the notebook workspace are not stored as items in your organization and are not deleted when the notebook is deleted. To delete files, select the file in the Files pane and click Delete. Optionally, select the file on the Manage files page and click Delete. If you are removed from your organization, all content in your notebook workspace is permanently deleted.

Download content from the workspace

You can save a file from the workspace to your local machine. In the notebook editor Files pane, browse to the file and select it. The file is automatically downloaded to your machine. Optionally, find the file on the Manage files page, click the More Options button Options, and click Download. The file is downloaded to your machine.

Set up a scratch workspace environment for use with ArcPy

The scratch workspace is intended for output data that you do not intend to maintain.

To create and use a scratch workspace environment, complete the following steps:

  1. Use the code below to create a scratch file geodatabase in the user workspace directory, if it does not already exist, and set the scratch geodatabase as the scratch workspace.

    import arcpy
    if not arcpy.Exists('/arcgis/home/scratch.gdb'):
        arcpy.management.CreateFileGDB('/arcgis/home','scratch.gdb')
    arcpy.env.scratchWorkspace = '/arcgis/home/scratch.gdb'

  2. Use the code below to verify that the geodatabase is set as the scratch geodatabase environment.

    print(arcpy.env.scratchGDB)

Create a folder to use as a scratch workspace

To create a folder to use as a scratch workspace, complete the following steps:

  1. Use the code below to create a folder in the user workspace, if one does not already exist, and set that folder as the user workspace.
    import arcpy
    if not arcpy.Exists('/arcgis/home/scratch'):
        arcpy.management.CreateFolder('/arcgis/home', 'scratch')
    arcpy.env.scratchWorkspace = '/arcgis/home/scratch'
  2. Use the code below to verify that the folder is set as the scratch folder environment.
    print(arcpy.env.scratchFolder)