CSV File Format

The format for a CSV file is as follows:

*Comments
            [Command]
            Header (Keywords)
            values (separated by commas)
            *Comments

where Command = [Tags], [Data], [Messages], or [Alarms] and Keywords = (see the following list). Please note that the order of the data must match the order in the header. For example, if you are importing a tagname, timestamp, value, and quality you would use the following syntax:

[Data] 
Tagname,TimeStamp,Value,DataQuality TIGER.IMPORT_TAG1.F_CV,7/20/01 11:07,1,Good

Data values for a single entry should be kept on one line.

While importing an Alarms and Events only the following headers are considered.

  • Acked
  • Acktime
  • Actor
  • AlarmID
  • Condition
  • DataSource
  • Enabled
  • EndTime
  • EventCategory
  • ItemID
  • Message
  • Quality
  • Severity
  • Source
  • StartTime
  • SubCondition
  • Tagname
  • Timestamp

The following table lists the available header keywords:

DataQualityValue
TagnameDescription
EngineeringUnitsComment
DataType StringLength
StoreMillisecondsCollectorName
CollectorTypeSourceAddress
CollectorTypeCollectionInterval
CollectionOffsetCollectionDisabled
LoadBalancingTimeStamp
TypeTimeZoneBias
HiEngineeringUnitsLoEngineeringUnits
InputScalingHiScale
LoScaleCollectorCompression
CollectorDeadbandPercentRangeCollectorCompressionTimeout
ArchiveCompressionArchiveDeadbandPercentRange
ArchiveCompressionTimeoutTimeout
CollectorGeneral1CollectorGeneral2
CollectorGeneral3CollectorGeneral4
CollectorGeneral5ReadSecurityGroup
WriteSecurityGroupAdministratorSecurityGroup
CalculationCalculationDependencies
AckedCondition
SubConditionEventCategory
MessageSource
SeverityStartTime
EndTimeTimestampType
SpikeLogicSpikeLogicOverride
InterfaceAbsoluteDeadbandInterfaceAbsoluteDeadbanding
LastModifiedLastModifiedUser
ArchiveAbsoluteDeadbandArchiveAbsoluteDeadbanding
StepValueValue
SpikeLogicSpikeLogicOverride
NumberOfElementsCalcType
Note:
  • StringLength = 2 times the number of characters (ASCII, Single Byte). For example, "ABC" = 6 StringLength.
  • TimeStamp: Timestamp resolution is in milliseconds for this collector. Do not try to import microsecond timestamps.

You cannot import Last Modified User, Last Modified Date, and Calculation Execution Time fields on a tag.

Example of CSV File that Imports Tags

* This is a comment

[Tags]
Tagname,Description,DataType,HiEngineeringUnits,LoEngineeringUnits    
TIGER.IMPORT_TAG1.F_CV,Import Tag 1,SingleFloat,35000,0
TIGER.IMPORT_TAG2.F_CV,Import Tag 2,SingleFloat,35000,0
TIGER.IMPORT_TAG3.F_CV,Import Tag 3,SingleFloat,35000,0
TIGER.IMPORT_TAG4.F_CV,Import Tag 4,SingleFloat,35000,0
TIGER.IMPORT_TAG5.F_CV,Import Tag 5,SingleFloat,35000,0
TIGER.IMPORT_TAG6.F_CV,Import Tag 6,SingleFloat,35000,0
TIGER.IMPORT_TAG7.F_CV,Import Tag 7,SingleFloat,35000,0
TIGER.IMPORT_TAG8.F_CV,Import Tag 8,SingleFloat,35000,0
TIGER.IMPORT_TAG9.F_CV,Import Tag 9,SingleFloat,35000,0
TIGER.IMPORT_TAG10.F_CV,Import Tag 10,SingleFloat,35000,0 

Example of a CSV File that Imports Data and Data Quality

* This is a comment

[Data]
Tagname,TimeStamp,Value,DataQuality             
TIGER.IMPORT_TAG1.F_CV,7/20/01 11:07,1,Good
TIGER.IMPORT_TAG1.F_CV,7/20/01 11:08,2,Good
TIGER.IMPORT_TAG1.F_CV,7/20/01 11:09,3,Good
TIGER.IMPORT_TAG1.F_CV,7/20/01 11:10,4,Good 
TIGER.IMPORT_TAG1.F_CV,7/20/01 11:11,5,Bad 
TIGER.IMPORT_TAG1.F_CV,7/20/01 11:12,6,Bad 
TIGER.IMPORT_TAG1.F_CV,7/20/01 11:13,7,Good 
TIGER.IMPORT_TAG1.F_CV,7/20/01 11:14,8,Bad 
TIGER.IMPORT_TAG1.F_CV,7/20/01 11:15,9,Good 
TIGER.IMPORT_TAG1.F_CV,7/20/01 11:16,10,Good 
TIGER.IMPORT_TAG1.F_CV,7/20/01 11:17,11,Good 
TIGER.IMPORT_TAG1.F_CV,7/20/01 11:18,12,Good 
TIGER.IMPORT_TAG1.F_CV,7/20/01 11:19,13,Bad 
TIGER.IMPORT_TAG1.F_CV,7/20/01 11:20,14,Good 
TIGER.IMPORT_TAG1.F_CV,7/20/01 11:21,15,Good 
TIGER.IMPORT_TAG1.F_CV,7/20/01 11:22,16,Bad 
TIGER.IMPORT_TAG1.F_CV,7/20/01 11:23,17,Good 

Example of a CSV File that Imports Messages

[Messages]
TimeStamp,Topic,Username,MessageNumber,MessageString,Substitutions
28-Aug-2002 19:39:30.567,General,User1,0,A Test Message value 2 with milliseconds,,
28-Aug-2002 19:40:00.000,General,User1,0,A Test Message value 0,,            

Example of a CSV File that Imports Tags with Step Values

[Tags]
Tagname,Description,DataType,HiEngineeringUnits,LoEngineeringUnits 
TIGER.IMPORT_TAG1.F_CV,Import Tag 1,SingleFloat,35000,0
TIGER.IMPORT_TAG2.F_CV,Import Tag 2,SingleFloat,35000,0
TIGER.IMPORT_TAG3.F_CV,Import Tag 3,SingleFloat,35000,0
TIGER.IMPORT_TAG4.F_CV,Import Tag 4,SingleFloat,35000,0
TIGER.IMPORT_TAG5.F_CV,Import Tag 5,SingleFloat,35000,0
TIGER.IMPORT_TAG6.F_CV,Import Tag 6,SingleFloat,35000,0
TIGER.IMPORT_TAG7.F_CV,Import Tag 7,SingleFloat,35000,0
TIGER.IMPORT_TAG8.F_CV,Import Tag 8,SingleFloat,35000,0
TIGER.IMPORT_TAG9.F_CV,Import Tag 9,SingleFloat,35000,0
TIGER.IMPORT_TAG10.F_CV,Import Tag 10,SingleFloat,35000,0

Example of a CSV File that Imports Alarms

[Alarms]
DataSource,Condition,Source,StartTime,TimeStamp 
FileCollector,HI,Mixer,3/10/2005 12:52:02,3/10/2005 12:52:02
FileCollector,HIHI,Mixer,3/10/2005 12:52:02,3/10/2005 12:59:12            

Example of a CSV File that Imports Enumerated Set

[EnumeratedSet] 
SetName,SetDescription,StateLowValue,StateHighValue,StateDescription,StateName,StateRawValueDataType,
LastModified,LastModifiedUser,AdministerSecurityGroup,NumberOfStatesInThisSet
TestSet5,TestDesc,1,10,State1Desc,State1,DoubleFloat,,,,2
TestSet5,TestDesc,11,20,State2Desc,State2,DoubleFloat,,,,2            

Example of a CSV File that Imports Array Tags

[Tags]
Tagname,Description,DataType,HiEngineeringUnits,LoEngineeringUnits,NumberOfElements 
TIGER.IMPORT_TAG1.F_CV,Import Tag 1,SingleFloat,35000,0,-1
TIGER.IMPORT_TAG2.F_CV,Import Tag 2,SingleFloat,35000,0,0
TIGER.IMPORT_TAG3.F_CV,Import Tag 3,SingleFloat,35000,0,-1
TIGER.IMPORT_TAG4.F_CV,Import Tag 4,SingleFloat,35000,0,-1             

Example of a CSV File that Imports Array Tag Data

[Data]
Tagname,TimeStamp,Value,DataQuality 
ArrayTag[0],6/11/2013 09:00:00,1,Good 
ArrayTag[1],6/11/2013 09:00:00,2,Good 
ArrayTag[2],6/11/2013 09:00:00,3,Good 
ArrayTag[3],6/11/2013 09:00:00,4,Good 
ArrayTag[0],6/11/2013 09:10:00,5,Good 
ArrayTag[1],6/11/2013 09:10:00,6,Good 
ArrayTag[2],6/11/2013 09:10:00,7,Good

Example of a CSV File that Imports MultiField Tag Data

[Data]
Tagname,TimeStamp,Value,DataQuality 
MultiField.F1,05-22-2013 14:15:00,4,Good 
MultiField.F1,05-22-2013 14:15:01,7,Good 
MultiField.F1,05-22-2013 14:15:02,9,Good 
MultiField.F2,05-22-2013 14:15:00,241,Good 
MultiField.F2,05-22-2013 14:15:01,171,Good 
MultiField.F2,05-22-2013 14:15:02,191,Good
Note: Before importing MultiField tag data in this format, you should add the User Defined Type using Historian Administrator and associate that type to the MultiField tag.

Example of how to import a user defined type

The following example allows you to import a user defined type UDT1 with two fields, Field1, Field2. After creating, UDT1 associates with a tag called Mfield.
[UserDefinedType]
UserDefinedTypeName,UserDefinedTypeDescription,FieldName,FieldDescription,FieldDataType,IsMasterField,NumberOfFields
UDT1,UDTdesc,Field1,F1desc,SingleInteger,FALSE,2
UDT1,UDTdesc,Field2,F2desc,DoubleInteger,FALSE,2
[Tags]
Tagname,Description,DataType,UserDefinedTypeName
Mfield,mfdesc,MultiField,UDT1

Example of a CSV File that Imports Python Expression Tags

[Tag] 
Tagname,CollectorName,CalcType,SourceAddress,DataType,Description      
TagDerivedFromRawValue,SimulationCollector,PythonExpr,"{""imports"":[""math""],
""script"":""tag.value + math.pow10,tag.value/70)"",""parameters"":[{""name"":
""tag"",""source"":{""address"":""Simulation00001"",""dataType"":""SingleFloat""}}]}",
SingleFloat,Python Expression Tag example                   
Note:
  • Python Expression Tags do not support array or multifield tags.
  • It is important to include the CalcType header and set it to PythonExpr for each Python Expression tag. If the file contains a mix of tags that are Python Expression Tags with those that are not, then the tags that are not should have the CalcType field set to Raw.
  • For Python Expression Tags, the SourceAddress must contain the tag's minified JSON configuration constructed as described in the topic on Constructing the JSON Configuration for a Python Expression Tag. (Mini- fied JSON has no newline characters or comments. There are tools which can help you minify JSON.)
  • Note that the example in the CSV file uses repeated quotation marks ("") in order to escape quotation marks ("), which are a special character.
  • It is important to check that your JSON is valid, since no validation will be performed on the JSON at tag creation.

For more information on these tags, refer to the Python Expression Tags .