Skip to main content
Version: V2 (Ignition 8.1)

system.mes.location.exportAsCsv

Description​

Exports all or selected Locations as a CSV string (UTF-8 encoded). Streams location data from the database and formats it as a CSV string, including a header row. When idsOrPaths is omitted, all locations are exported.

Permissions​

This method requires the LOCATION.READ.GET permission.

Syntax​

system.mes.location.exportAsCsv()
system.mes.location.exportAsCsv(idsOrPaths=["Enterprise/Site/Line1"])

Parameters​

ParameterTypeNullableDescription
idsOrPathsString[]YesThe ids or paths of the locations to export. Omit to export all.

Returns​

All locations as a CSV string (UTF-8 encoded).

Code Examples​

Perspective​

csvString = system.mes.location.exportAsCsv()
system.perspective.download("locations.csv", csvBytes)

Script Console​

csvString = system.mes.location.exportAsCsv()
path = system.file.saveFile("locations.csv")
if path is not None:
system.file.writeFile(path, csvString)