# Import bit alarm tags from .csv to Ignition byte tags

**URL:** <https://forum.inductiveautomation.com/t/import-bit-alarm-tags-from-csv-to-ignition-byte-tags/29870>\
**Category:** Ignition\
**Tags:** ignition79\
**Created:** [November 12, 2019, 12:12pm UTC](https://forum.inductiveautomation.com/t/import-bit-alarm-tags-from-csv-to-ignition-byte-tags/29870 "2019-11-12T12:12:59Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![zxcslo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zxcslo/32/61610_2.png) [@zxcslo](https://forum.inductiveautomation.com/u/zxcslo)\
**Post date:** [November 12, 2019, 6:18pm UTC](https://forum.inductiveautomation.com/t/import-bit-alarm-tags-from-csv-to-ignition-byte-tags/29870/3 "2019-11-12T18:18:17Z")

</div>

Kudos @JordanCClark 👍  
Thank you.  
Just a little correction (for mode and DataType):

```auto
import csv

OPCServer='Ignition OPC-UA Server'
deviceName='[testrampe]'	#what name you have in Ignition/Config/Devices website
alarmFolderName=u"testrampe/Alarms"	#In which folder in Tag Browser in the designer you want to put your alarms
scanClass='Default'	#which scanclass should your alarms tags run under
priority=2	#priority of the alarm:0-Diagnostic, 1-Low, 2-Medium, 3-High, 4-Critical

pathIn=system.file.openFile('csv')
#pathIn = 'c:/test/testFileIn.txt'
fileIn = open(pathIn, 'rb')

reader=csv.reader(fileIn, delimiter = ';')

dictIn = {}

# Read File into dictionary
for row in reader:
	# Split address into byte/bit
	address = row[0].split('.') 
	address[0] = address[0].replace("M","MB")
	if address[0] not in dictIn.keys():
		dictIn[address[0]] = {}
	dictIn[address[0]][address[1]] = row[1]

# Create tags		
for byte in (dictIn.keys()):
	alarmDict = {}
	# Create alarm dictionary for each tag
	for bit in sorted(dictIn[byte].keys()):
		alarmtext = dictIn[byte][bit]
		alarmDict[alarmtext] = [["name", "Value", alarmtext],
        			 			["priority","Value", priority], 
        						["label", "Value", alarmtext],
        						["mode","Value", 9], 
        						["bitPosition","Value", int(bit)], 
        						["ackMode", "Value", 1]]
	system.tag.addTag(parentPath=alarmFolderName, 
						name=byte, 
						tagType = "OPC",  
						attributes={"OPCServer" : OPCServer, 
						"DataType" : 0,
						"OPCItemPath" : deviceName+byte, 
        				"ScanClass" : scanClass}, 
						alarmConfig = alarmDict
						)

```

and it’s working perfectly.  
Again, 👍🙇‍♂️

---

_[View the full topic](https://forum.inductiveautomation.com/t/import-bit-alarm-tags-from-csv-to-ignition-byte-tags/29870)._
