Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AF SDK Reference

PISystem.ImportCsv Method (AFDatabase, PIImportMode, CultureInfo, String, EventHandler(AFProgressEventArgs))

PISystem.ImportCsv Method (AFDatabase, PIImportMode, CultureInfo, String, EventHandler(AFProgressEventArgs))

  • Last UpdatedNov 18, 2025
  • 3 minute read
PISystem.ImportCsv Method (AFDatabase, PIImportMode, CultureInfo, String, EventHandler(AFProgressEventArgs))
Imports the comma-separated value (CSV) representation of any object from a file.

Namespace:  OSIsoft.AF
Assembly:  OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182

Syntax

public int ImportCsv(
	AFDatabase targetDB,
	PIImportMode importMode,
	CultureInfo culture,
	string csvData,
	EventHandler<AFProgressEventArgs> handler
)
Public Function ImportCsv ( 
	targetDB As AFDatabase,
	importMode As PIImportMode,
	culture As CultureInfo,
	csvData As String,
	handler As EventHandler(Of AFProgressEventArgs)
) As Integer

Dim instance As PISystem
Dim targetDB As AFDatabase
Dim importMode As PIImportMode
Dim culture As CultureInfo
Dim csvData As String
Dim handler As EventHandler(Of AFProgressEventArgs)
Dim returnValue As Integer

returnValue = instance.ImportCsv(targetDB, 
	importMode, culture, csvData, handler)
public:
int ImportCsv(
	AFDatabase^ targetDB, 
	PIImportMode importMode, 
	CultureInfo^ culture, 
	String^ csvData, 
	EventHandler<AFProgressEventArgs^>^ handler
)
member ImportCsv : 
        targetDB : AFDatabase * 
        importMode : PIImportMode * 
        culture : CultureInfo * 
        csvData : string * 
        handler : EventHandler<AFProgressEventArgs> -> int 

Parameters

targetDB
Type: OSIsoft.AFAFDatabase
The AFDatabase into which the CSV data should be imported.
importMode
Type: OSIsoft.AFPIImportMode
One or more of the PIImportMode values which indicates how to import.
culture
Type: System.GlobalizationCultureInfo
The culture-specific settings to be used for conversion of times, dates, floating-point values, etc. If , the current culture will be assumed. If the invariant culture is specified, then DateTime's will be assumed to be in UTC time.
csvData
Type: SystemString
The fully-qualified pathname to a file containing the CSV data or the CSV data itself. If the CSV data is passed in a string to ImportCsv, each line should be terminated by a carriage return and newline.
handler
Type: SystemEventHandlerAFProgressEventArgs
Event handler method that will be called after each line of the CSV data is processed. If , import will occur silently.

Return Value

Type: Int32
Returns the number of items updated or created.

Remarks

The CSV representation of the objects are imported into the specified target PI Asset Database.

Version Information

AFSDK


See Also

In This Topic
Related Links
TitleResults for “How to create a CRG?”Also Available in