Is there a way to return the number of columns in a table? Is there a way to return the number of columns in a table?

I tried {{ entry.tableHandle | length }} but this seems to return the number of rows rather than columns.

I've got a site with a couple of tables and I'm trying to output the number of columns in a given table to use for my CSS responsive column width.

I.E. If table was 2 columns, it would output a 2 and I would use that to set column width to 50% etc...
entry.tableHandle is an array of all of the rows, and each row is an array with keys that are the column names and values that are the column values AND keys that are col1, col2, etc. and values that are the column values.

So you can do entry.tableHandle[0]|keys to get the keys, entry.tableHandle[0]|keys|length to get the number of keys, and finally (entry.tableHandle[0]|keys|length)/2 to get the number of columns.

You will want to check first that there is a row in the table - this won't work if there is no row 0.