---
title: "system.mes.spc.analysis.exportSPCResults(settings, [locale], [csvSeparator], [filter])"
id: "system-mes-spc-analysis-exportspcresults-settings-locale-csvseparator-filter"
project: "MES User Manual"
url: "https://docs.sepasoft.com/articles/user-manual/system-mes-spc-analysis-exportspcresults-settings-locale-csvseparator-filter"
updated: 2026-07-31T14:54:44Z
---

# system\.mes\.spc\.analysis\.exportSPCResults\(settings, \[locale\], \[csvSeparator\], \[filter\]\)

**Sepasoft MES Module Suite**

### system.mes.spc.analysis.exportSPCResults(settings, [locale], [csvSeparator], [filter])

Export SPC data to a CSV formatted string. This function accepts [keyword arguments.](https://docs.inductiveautomation.com/display/DOC79/User-Defined-Functions#UserDefinedFunctions-KeywordArguments)

| ![Warning](/resources/Storage/user-manual/user-manual/Warning.png) | **Scripting Function modifications in**<br><br>MES 3.79.3 RC 5 and later<br>MES 3.81.4 RC 5 and later |
| --- | --- |

Syntax

system.mes.spc.analysis.exportSPCResults(settings, [locale], [csvSeparator], [filter])

* Parameters

SPCSettings **settings** - An instance of a [SPCSettings](/articles/user-manual/spc-settings) object to base the export results. Use the system.mes.spc.analysis.createSettings script function to create the SPCSettings object.

String **locale** - The locale name to be used for formatting numeric values. Defaults to Gateway locale.

String **csvSeparator** - Column names to include in the export separated by commas. Defaults to ‘,’.

String **filter** - Column names to include in the export separated by commas. Defaults to all columns.

* Returns

String - A string containing the exported SPC data in CSV format.

* Scope

All

Code Example

```python
locationPath = 'Enterprise\El Dorado Hills\Packaging Area\Packaging Line 1\Inspection Station 1'

startDate = system.mes.spc.analysis.formatDate(system.date.addHours(system.date.now(), -1))
endDate = system.mes.spc.analysis.formatDate(system.date.now())

definitionName = 'Case Inspection'
attribute = 'Fill Level'

controlLimits = ''
signals = ''
dataFormatName = 'Process Capability and Performance'
filters=''

spcsettings = system.mes.spc.analysis.createSettings(definitionName, attribute, filters, controlLimits, signals, dataFormatName)
filter = spcsettings.encodeList(['FromDate='+startDate,'ToDate='+endDate,'Location='+locationPath])
spcsettings.setFilters(filter)

csv = system.mes.spc.analysis.exportSPCResults(spcsettings)
#save your file as needed
print csv
```

```
>>> 
"Low Boundary","High Boundary","Frequency","Cp","Cpk","Cr","Cpm","Cpl","Cpu","CpLCL","CpUCL","CpStdDev","Pp","Ppk","Pr","Ppm","Ppl","Ppu","PpLCL","PpUCL","PpStdDev","Mean","SampleUUID","Note","NoteEnteredBy","LastUpdated","Cause","SampleTakenDateTime"
"-4.503","-3.632","0","0.227","0.09","4.396","0","0.365","0.09","-4.503","10.003","2.418","0.209","0.082","4.787","0","0.336","0.082","-5.149","10.649","2.633","2.75","","","","","",""
"-3.632","-2.761","0","0.227","0.09","4.396","0","0.365","0.09","-4.503","10.003","2.418","0.209","0.082","4.787","0","0.336","0.082","-5.149","10.649","2.633","2.75","","","","","",""
"-2.761","-1.889","0","0.227","0.09","4.396","0","0.365","0.09","-4.503","10.003","2.418","0.209","0.082","4.787","0","0.336","0.082","-5.149","10.649","2.633","2.75","","","","","",""
"-1.889","-1.018","0","0.227","0.09","4.396","0","0.365","0.09","-4.503","10.003","2.418","0.209","0.082","4.787","0","0.336","0.082","-5.149","10.649","2.633","2.75","","","","","",""
"-1.018","-0.146","0","0.227","0.09","4.396","0","0.365","0.09","-4.503","10.003","2.418","0.209","0.082","4.787","0","0.336","0.082","-5.149","10.649","2.633","2.75","","","","","",""
"-1.663","-0.791","0","0.227","0.09","4.396","0","0.365","0.09","-4.503","10.003","2.418","0.209","0.082","4.787","0","0.336","0.082","-5.149","10.649","2.633","2.75","","","","","",""
"-2.534","-1.663","0","0.227","0.09","4.396","0","0.365","0.09","-4.503","10.003","2.418","0.209","0.082","4.787","0","0.336","0.082","-5.149","10.649","2.633","2.75","","","","","",""
"-3.406","-2.534","0","0.227","0.09","4.396","0","0.365","0.09","-4.503","10.003","2.418","0.209","0.082","4.787","0","0.336","0.082","-5.149","10.649","2.633","2.75","","","","","",""
"-4.277","-3.406","0","0.227","0.09","4.396","0","0.365","0.09","-4.503","10.003","2.418","0.209","0.082","4.787","0","0.336","0.082","-5.149","10.649","2.633","2.75","","","","","",""
"-5.149","-4.277","0","0.227","0.09","4.396","0","0.365","0.09","-4.503","10.003","2.418","0.209","0.082","4.787","0","0.336","0.082","-5.149","10.649","2.633","2.75","","","","","",""
"-0.921","-0.05","0","0.227","0.09","4.396","0","0.365","0.09","-4.503","10.003","2.418","0.209","0.082","4.787","0","0.336","0.082","-5.149","10.649","2.633","2.75","","","","","",""
"-0.05","0.821","4","0.227","0.09","4.396","0","0.365","0.09","-4.503","10.003","2.418","0.209","0.082","4.787","0","0.336","0.082","-5.149","10.649","2.633","2.75","","","","","",""
"0.821","1.693","1","0.227","0.09","4.396","0","0.365","0.09","-4.503","10.003","2.418","0.209","0.082","4.787","0","0.336","0.082","-5.149","10.649","2.633","2.75","","","","","",""
"1.693","2.564","2","0.227","0.09","4.396","0","0.365","0.09","-4.503","10.003","2.418","0.209","0.082","4.787","0","0.336","0.082","-5.149","10.649","2.633","2.75","","","","","",""
"2.564","3.436","0","0.227","0.09","4.396","0","0.365","0.09","-4.503","10.003","2.418","0.209","0.082","4.787","0","0.336","0.082","-5.149","10.649","2.633","2.75","","","","","",""
"3.436","4.307","0","0.227","0.09","4.396","0","0.365","0.09","-4.503","10.003","2.418","0.209","0.082","4.787","0","0.336","0.082","-5.149","10.649","2.633","2.75","","","","","",""
"4.307","5.179","2","0.227","0.09","4.396","0","0.365","0.09","-4.503","10.003","2.418","0.209","0.082","4.787","0","0.336","0.082","-5.149","10.649","2.633","2.75","","","","","",""
"5.179","6.05","3","0.227","0.09","4.396","0","0.365","0.09","-4.503","10.003","2.418","0.209","0.082","4.787","0","0.336","0.082","-5.149","10.649","2.633","2.75","","","","","",""
"6.05","6.921","0","0.227","0.09","4.396","0","0.365","0.09","-4.503","10.003","2.418","0.209","0.082","4.787","0","0.336","0.082","-5.149","10.649","2.633","2.75","","","","","",""
"6.05","6.921","0","0.227","0.09","4.396","0","0.365","0.09","-4.503","10.003","2.418","0.209","0.082","4.787","0","0.336","0.082","-5.149","10.649","2.633","2.75","","","","","",""
"6.921","7.793","0","0.227","0.09","4.396","0","0.365","0.09","-4.503","10.003","2.418","0.209","0.082","4.787","0","0.336","0.082","-5.149","10.649","2.633","2.75","","","","","",""
"7.793","8.664","0","0.227","0.09","4.396","0","0.365","0.09","-4.503","10.003","2.418","0.209","0.082","4.787","0","0.336","0.082","-5.149","10.649","2.633","2.75","","","","","",""
"8.664","9.536","0","0.227","0.09","4.396","0","0.365","0.09","-4.503","10.003","2.418","0.209","0.082","4.787","0","0.336","0.082","-5.149","10.649","2.633","2.75","","","","","",""
"9.536","10.407","0","0.227","0.09","4.396","0","0.365","0.09","-4.503","10.003","2.418","0.209","0.082","4.787","0","0.336","0.082","-5.149","10.649","2.633","2.75","","","","","",""
"9.536","10.407","0","0.227","0.09","4.396","0","0.365","0.09","-4.503","10.003","2.418","0.209","0.082","4.787","0","0.336","0.082","-5.149","10.649","2.633","2.75","","","","","",""
"10.407","11.278","0","0.227","0.09","4.396","0","0.365","0.09","-4.503","10.003","2.418","0.209","0.082","4.787","0","0.336","0.082","-5.149","10.649","2.633","2.75","","","","","",""

>>> 
```


**Sepasoft MES Module Suite**