# Importing Java in ActionPerformed Script in Perspective

**URL:** <https://forum.inductiveautomation.com/t/importing-java-in-actionperformed-script-in-perspective/84002>\
**Category:** Ignition\
**Tags:** perspective, scripting\
**Created:** [January 9, 2024, 7:37pm UTC](https://forum.inductiveautomation.com/t/importing-java-in-actionperformed-script-in-perspective/84002 "2024-01-09T19:37:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ryan\_Heintzleman](https://avatars.discourse-cdn.com/v4/letter/r/da6949/32.png) [@Ryan\_Heintzleman](https://forum.inductiveautomation.com/u/Ryan_Heintzleman)\
**Post date:** [January 9, 2024, 7:37pm UTC](https://forum.inductiveautomation.com/t/importing-java-in-actionperformed-script-in-perspective/84002/1 "2024-01-09T19:37:46Z")

</div>

I was trying to append some data to a dataset before exporting to excel (system.dataset.toExcel) to include some parameters that generated that dataset, but I was having a lot of trouble making them append correctly due to datatypes... I finally got it working in Script Console, but I had to use java.util.Date for the date format... which doesn't want to import in Perspective? I kept searching through the documentation but I couldn't find anything else (I feel like there should be a system.date type I could use?). Any advice would be appreciated.

````auto
def runAction(self, event):
	from java.util import Date
	
	StartDate = self.getSibling("DateTimeInput_Start").props.value
	EndDate = self.getSibling("DateTimeInput_End").props.value
	Lines = self.getSibling("Dropdown_Source").props.value
	
	Col1 = ['Start Date Filter:', 'End Date Filter:', 'Filter Source: ' + Lines]
	Col2 = [StartDate, EndDate]
	
	Data = self.getSibling("Table").props.data
	DataRows = Data.getRowCount()
	
	if DataRows < 3:
		while DataRows < 3:
			Data = system.dataset.addRow(Data, [None, None, None, None, None, None, None])
			DataRows = Data.getRowCount()
	
	while len(Col1) < DataRows:
		Col1.append('')
	while len(Col2) < DataRows:
		Col2.append(None) 
	
	Data = system.dataset.addColumn(Data, 6, Col1, 'Parameters', str)
	Data = system.dataset.addColumn(Data, 7, Col2, 'Parameters ', java.util.Date)
	
	DataOut = system.dataset.toExcel(True, Data)
	FileName = 'Report %s.xlsx' % system.date.format(system.date.now(), 'yyyy-MM-dd HH:mm')
	system.perspective.download(FileName, DataOut)```
````

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [January 9, 2024, 8:14pm UTC](https://forum.inductiveautomation.com/t/importing-java-in-actionperformed-script-in-perspective/84002/2 "2024-01-09T20:14:18Z")

</div>

In line 25, you called out `java.util.Date`, though you imported `Date`. To use the fully qualified name, you typically need to `import java`. Otherwise, omit `java.util.` in line 25.
