Hello @Luke_Malkasian,
Great question and super cool use case.
To change the column headers for the table of a database, you will need to change the schema of that table.
For a SQL database, you would use syntax such as ALTER TABLE table_name RENAME COLUMN old_name to new_name;
which could be run in a SQL query.
Where you should be able to interpolate in the new_name
from a text input component with something like {{textInput1.data}}
.
For excel, I do not believe we have a built in query action that accomplishes this. You would likely need to check their docs to see if they have an API where you can make a request to an endpoint with the information needed to find you account, table, column and pass along the new name
This can be done easily from Excel's GUI but doing it programmatically is a bit more tricky. I found these docs from Microsoft and ChatGPT might be helpful for understanding the docs and the query you would need.
Then you could use a REST API resource/query in Retool to hit the endpoint with the necessary info to accomplish the renaming.
@WidleStudioLLP's solution gets close to accomplishing a purely aesthetic renaming of the column names in a table component but these changes would not be saved to the database/excel sheet unfortunately.
I would say that renaming columns can be risky as it will change the database which could have spillover issues.
The best architecture for your use-case might be to generate a temp state using a JS variable in Retool that the user can make edits to, then once finalized you can lock this finalized DB schema in by creating a table with the given column names.
As opposed to creating a table then trying to do "database surgery" to tweak column names