Can someone please help with the script to export my tags to excel?
I’m very new to this but I think i am missing a step before the toExcel command.
Please refer below:
Thanks but you may need to dumb it down for me.
Assuming the tags are not UDTInstances (because you set recursive False), following script would work.
path = "[default]SMS_Test" config = system.tag.browse(path) #you can specify any filters you need here tags = [[str(tagPath['fullPath']),str(tagPath['name']),str(tagPath['dataType']),tagPath['value'].value] for tagPath in config.getResults()] #you can add more columns here #convert to dataset tagsDS = system.dataset.toDataSet(["Tag Path","Tag Name","Data Type","Value"],tags ) spreadsheet = system.dataset.toExcel(True,[tagsDS])
In case you want write this into Excel and see, add below
filePath = "C:\\Users\\Gaurav_Shitole\\Desktop\\test\\myTags.xls" #write here your filePath to save excel system.file.writeFile(filePath,spreadsheet)
Above is tested and worked, let me know if you need anything else.