# Tag export to Excel

**URL:** <https://forum.inductiveautomation.com/t/tag-export-to-excel/42802>\
**Category:** Ignition\
**Tags:** ignition80\
**Created:** [February 1, 2021, 5:11am UTC](https://forum.inductiveautomation.com/t/tag-export-to-excel/42802 "2021-02-01T05:11:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![matthew.roberts](https://avatars.discourse-cdn.com/v4/letter/m/ecd19e/32.png) [@matthew.roberts](https://forum.inductiveautomation.com/u/matthew.roberts)\
**Post date:** [February 1, 2021, 5:11am UTC](https://forum.inductiveautomation.com/t/tag-export-to-excel/42802/1 "2021-02-01T05:11:34Z")

</div>

Hi  
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.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/7/a7fbefce53c54a4dfbeee34950f879027c2dd2a5.png) [Tags to Excel.pdf](https://forum.inductiveautomation.com/uploads/short-url/xVGCIWTc5mr1SVny0fOZIQL3Ljd.pdf) (16.3 KB)

---

<div class="post-metadata">

**Author:** ![Gaurav.Shitole](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/gaurav.shitole/32/72050_2.png) [@Gaurav.Shitole](https://forum.inductiveautomation.com/u/Gaurav.Shitole)\
**Post date:** [February 1, 2021, 7:36am UTC](https://forum.inductiveautomation.com/t/tag-export-to-excel/42802/2 "2021-02-01T07:36:50Z")

</div>

Please refer below:

> [@Tag to Excel](http://forum.inductiveautomation.com/t/tag-to-excel/12484):
>
> Looking for the best option to write a few tags to Excel for a customer at 5 min interval. In the following format Tagname Date Value Units e.g. Tag1 11:00 6 m3/h Tag2 11:00 6.3 m Tag3 11:00 5.5 bar Tag1 11:05 6.2 m3/h Tag2 11:05 7.1 m Tag3 11:05 3.5 bar I tried using a query and writing the dataset to excel but they were coming out in columns ie t\_stamp Tag1 Tag2 Tag3 11:00 6 6.3 5.5 11:05 6.2 7.1 3.5

---

<div class="post-metadata">

**Author:** ![matthew.roberts](https://avatars.discourse-cdn.com/v4/letter/m/ecd19e/32.png) [@matthew.roberts](https://forum.inductiveautomation.com/u/matthew.roberts)\
**Post date:** [February 1, 2021, 8:06am UTC](https://forum.inductiveautomation.com/t/tag-export-to-excel/42802/3 "2021-02-01T08:06:17Z")

</div>

Thanks but you may need to dumb it down for me.

---

<div class="post-metadata">

**Author:** ![Gaurav.Shitole](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/gaurav.shitole/32/72050_2.png) [@Gaurav.Shitole](https://forum.inductiveautomation.com/u/Gaurav.Shitole)\
**Post date:** [February 2, 2021, 6:55am UTC](https://forum.inductiveautomation.com/t/tag-export-to-excel/42802/4 "2021-02-02T06:55:24Z")

</div>

Ok @matthew.roberts,

Assuming the tags are not UDTInstances (because you set recursive False), following script would work.

```auto
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

```auto
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.
