Skip to main content
Version: V3 (Ignition 8.3)

system.mes.material.importFromCsv

Description​

Imports Materials from a CSV file provided as raw bytes. The service layer parses the CSV content and creates or updates material entities.

Recommended to export at least one pre-existing material to CSV using the Export Materials functionality to ensure the correct format of the CSV file.

Syntax​

system.mes.material.importFromCsv(importBytes)

Parameters​

ParameterTypeNullableDescription
importBytesPyArrayFalseThe CSV content as raw bytes.

Returns​

An ApiResponse object where data is the number of materials successfully imported or updated.

Code Examples​

Here is an example of how to use the importFromCsv method in the context of a Perspective File Upload Component onFileReceived event handler. Reference Perspective - File Upload Scripting for more information on the onFileReceived event handler.

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