Skip to main content
Version: 8.1


This function is used in Python Scripting.


Exports tags to a file on a local file system.

The term "local file system" refers to the scope in which the script was running; for example, running this script in a Gateway Timer script will export the file to the Gateway file system.

Client Permission Restrictions

This scripting function has no Client Permission restrictions.



This function accepts keyword arguments.

system.tag.exportTags([filePath], tagPaths, [recursive], [exportType])


String or NothingfilePathThe file path that the tags will be exported to. If the file does not already exist, this function will attempt to create it.
Changed in 8.1.8
Previously, the filePath parameter was required. If omitted, causes the function to return the tag export as a string.
ListtagPathsA List of tag paths to export. All tag paths in the list must be from the same parent folder.
BooleanrecursiveSet to true to export all tags under each tag path, including tags in child folders. Defaults to true. [optional]
StringexportTypeThe type of file that will be exported. Set to "json" or "xml". Defaults to "json".




Gateway, Vision Client, Perspective Session

Code Examples

Example #1
# This example attempts to export the entire Tag Provider, including UDT definitions.

# The filepath is Operating System dependent, so the path notation below may differ based on where the function is called from.
filePath = 'C:\\Users\\myUser\\Desktop\\myTags'
tagPaths = ["[default]"]
recursive = True

system.tag.exportTags(filePath, tagPaths, recursive)
Example #2
# Exports the entire tag provider named "default" as a string, and
# returns the string to a "tags" variable.
tags = system.tag.exportTags(tagPaths = ["[default]"])


system tag exportTags, tag.exportTags