# Edge perspective Alarm Journal export

**URL:** <https://forum.inductiveautomation.com/t/edge-perspective-alarm-journal-export/114429>\
**Category:** General Discussion\
**Tags:** perspective\
**Created:** [March 10, 2026, 10:53pm UTC](https://forum.inductiveautomation.com/t/edge-perspective-alarm-journal-export/114429 "2026-03-10T22:53:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![casian](https://avatars.discourse-cdn.com/v4/letter/c/b19c9b/32.png) [@casian](https://forum.inductiveautomation.com/u/casian)\
**Post date:** [March 10, 2026, 10:53pm UTC](https://forum.inductiveautomation.com/t/edge-perspective-alarm-journal-export/114429/1 "2026-03-10T22:53:41Z")

</div>

Hi,

Can someone please help with exporting the Alarm Journal to an excel file, in a Perspective Edge project?

So far I’ve tried a script to a button but doesn’t work

```python
def runAction(self, event):
    journal = system.alarm.queryJournal().getDataset()
    spreadsheet = system.dataset.toExcel(True, [journal])
    filePath = "C:\output\results.xlsx"
    system.file.writeFile(filePath, spreadsheet)

```

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [March 10, 2026, 11:17pm UTC](https://forum.inductiveautomation.com/t/edge-perspective-alarm-journal-export/114429/2 "2026-03-10T23:17:03Z")

</div>

> [@casian](#):
>
> `system.file.writeFile(filePath, spreadsheet)`

This function (probably) does not do what you think it does in a Perspective context. Perspective scripts are actually running on the gateway, so this will be attempting to write to a file on the C drive wherever the gateway is installed, not wherever your browser session is running.

You (probably) want the `system.perspective.download` function.

---

<div class="post-metadata">

**Author:** ![casian](https://avatars.discourse-cdn.com/v4/letter/c/b19c9b/32.png) [@casian](https://forum.inductiveautomation.com/u/casian)\
**Post date:** [March 10, 2026, 11:34pm UTC](https://forum.inductiveautomation.com/t/edge-perspective-alarm-journal-export/114429/3 "2026-03-10T23:34:02Z")

</div>

Much appreciated!

It works but it still pops and error with this in the Output Console: [AWT-EventQueue-0] ERROR com.inductiveautomation.ignition.client.util.gui.ErrorUtil -- Unable to run action 'dom.onClick' on Main Views/Alarm Journal@D/root/CoordinateContainer: code could not be compiled.  
java.lang.Throwable: SyntaxError: no viable alternative at character '�??' (function:runAction, line 2)

Here’s my script now:

```python
def runAction(self, event):
    journal = system.alarm.queryJournal().getDataset()
    spreadsheet = system.dataset.toExcel(True, [journal])
    system.perspective.download(filename="AlarmJournalExport.xlsx", data=spreadsheet, contentType="application/vnd.ms-excel")

```

---

<div class="post-metadata">

**Author:** ![Austin\_Li](https://avatars.discourse-cdn.com/v4/letter/a/ea666f/32.png) [@Austin\_Li](https://forum.inductiveautomation.com/u/Austin_Li)\
**Post date:** [October 29, 2026, 6:36pm UTC](https://forum.inductiveautomation.com/t/edge-perspective-alarm-journal-export/114429/4 "2026-10-29T18:36:23Z")

</div>

I put something like this together, to be used with an Alarm Journal table:

```python
alarmTable = self.getSibling("AlarmJournalTable")

priorities = []
if alarmTable.props.filter.priorities.diagnostic == True:
    priorities.append(0)
if alarmTable.props.filter.priorities.low == True:
    priorities.append(1)
if alarmTable.props.filter.priorities.medium == True:
    priorities.append(2)
if alarmTable.props.filter.priorities.high == True:
    priorities.append(3)
if alarmTable.props.filter.priorities.critical == True:
    priorities.append(4)

states = []
if alarmTable.props.filter.events.cleared == True and alarmTable.props.filter.events.acked == False:
    states.append(0)
if alarmTable.props.filter.events.cleared == True and alarmTable.props.filter.events.acked == True:
    states.append(1)
if alarmTable.props.filter.events.active == True and alarmTable.props.filter.events.acked == False:
    states.append(2)
if alarmTable.props.filter.events.active == True and alarmTable.props.filter.events.acked == True:
    states.append(3)
if alarmTable.props.filter.events.enabled == True:
    states.append(4)
if alarmTable.props.filter.events.disabled == True:
    states.append(5)

# get alarms
alarms = system.alarm.queryJournal( 
    startDate=alarmTable.props.dateRange.historical.startDate #date
    , endDate=alarmTable.props.dateRange.historical.endDate #date
    , journalName=alarmTable.props.name #string
    , priority=priorities #list
    , state=states #list
    #, path=[alarmTable.props.filter.conditions.source] #list
    , source=[alarmTable.props.filter.conditions.source] #list
    , displaypath=[alarmTable.props.filter.conditions.displayPath] #list 
    #, all_properties # List[Tuple[String, String, Any]]
    #, any_properties # List[Tuple[String, String, Any]]
    #, defined # list[String]
    , includeData=True #False
    , includeSystem=False
    , includeShelved=False
    , isSystem=False
    , provider=[alarmTable.props.filter.conditions.provider] #list
) # a list of PyAlarmEvent objects

# convert to dataset
dataset = alarms.getDataset()

#headers = ['name', 'source', 'priority', 'desc']
#rows = []
#for r in results:
# system.perspective.print(r) 
# #Event[name=Alarm, source=prov:Regal_Transport:/tag:P04 WB Silos/Motors/AL_DIS_205/Sts_Alarm:/alm:Alarm, priority=Low, desc=null]
# rows.append([r['name'], r['source'], r['priority'], r['desc'] ])
#
#dataset = system.dataset.toDataset(headers, rows)

# download
datenow = str(system.date.format(system.date.now(), "yyyy-MM-dd_HH:mm"))
spreadsheet = system.dataset.dataSetToExcel(1, [dataset], 0)    
system.perspective.download("alarm-journal-" + datenow + ".xls", spreadsheet)        

```
