Get column headers

is there a way in the python scripting language to get the names of the headings on a table? In order to change a python dataset to a component dataset i need the headers. instead of hard coding the headers into a list i thought getting a list returned from a table component would be better.

Here, something like this should help:

existingData = event.source.parent.getComponent("Table").data headers = [existingData.getColumnName(c) for c in range(existingData.getColumnCount())]

it works great thanks.

the second line of your code has a weird syntax that i was unaware of. you are doing about 3 things all at one time. i would have written the line like this:

headers = []
for c in range(existingData.getColumnCount()):
    headers.append(existingData.getColumnName(c))

it is strange how your code gets the column name before the for loop.

Nifty, huh? Its my favorite Python language feature: list comprehensions.