Skip to main content

system.mes.equipment.importFromCsv

Description

Imports Equipment records from a CSV file provided as raw bytes. The service layer will parse the CSV content and create or update equipment records based on the file's columns.

Recommended to export at least one pre-existing equipment record to CSV using the exportAsCsv functionality to ensure the correct format.

Permissions

This method requires the EQUIPMENT.WRITE.SAVE permission.

Syntax

system.mes.equipment.importFromCsv(bytes)

Parameters

ParameterTypeNullableDescription
bytesPyArrayFalseThe CSV content as raw bytes.

Returns

Returns an ApiResponse containing import result details.

NameTypeDescription
successBooleanIndicates if the import was successful.
messageStringA summary of the import result.
dataStringDetails about the imported records.
errorStringAny errors encountered during import.

Code Examples

def runAction(self, event):
csvBytes = event.file.getBytes()
system.mes.equipment.importFromCsv(csvBytes)