Create a valid header for a perspective table

Hi everyone, I am trying to create data for my perspective table using the script below.

def runAction(self):
	data = []
	data.append({'Site Name':'Site A', 'Location':'Some where'}) = data

However, when I looked into the data prop field of the table, it raised the error that “invalid key”.

I know that the issue came from the ‘Site Name’ key. Because it contains a space character in the key. My question is how we can config the header with some special characters such as the space character in column keys.

Thank you so much for your time!

You need to supply the columns property to control the order and display details of the data property. Make the data property’s keys appropriate identifiers (no spaces). Then, for each column, in the order desired, set columns[nnn].field equal to the column identifier. Then set columns[nnn].header.title to the column name to be displayed. This title may have any characters you like.

Yeah, thank you so much for your help. I did not notice columns[nnn].header have a title property :joy: