N8n DataTables API for Columns Management (Add, Delete, Rename column)

The idea is:

Requesting for an n8n API endpoint for adding columns (/column/add), deleting columns (/column/delete), or renaming columns (/column/rename) of data tables.

My use case:

I’m creating a deployment pipeline for my workflows, and part of that is updating data tables from staging to production.
Some table updates have not just row additions, but also adding of new columns, deletion of old columns, or renaming of columns.
Deleting and creating new data tables with the same name but updated columns is a bad idea as it changes the ID of the old table.

I think it would be beneficial to add this because:

This would be helpful for any workflows that rely on changes to the structure of data tables.

Any resources to support this?

Are you willing to work on this?

I am, as I would directly benefit from this.

hello @selbainu in the meantime, while waiting for the such specific actions from n8n official node, you can use http request to do so :

First of all you need to get the cookie to be used to authenticate the API requests :

- URL : {{ your_n8n_instance_URL }}/rest/login

- method : POST

- payload :

{
"emailOrLdapLoginId":"your_email_address"
,"password":"your_password"
}

use below option to get the headers in the API response :

The cookie to use for next API requests is the below one : {{ $json.headers[“set-cookie”][0] }}

  • Add column from n8n table :

- URL : https://yourn8naccount.app.n8n.cloud/rest/projects/{{ yourPorjectId}}/data-tables/{{ n8n_table_ID }}/columns

- method : POST

- header :

{
"Cookie" : "{{ $json.headers[“set-cookie”][0] }}"
}

- payload :

{
"name":"Column_name_here",
"type":"string"
}

The different possible values for “type” : string, number, boolean, date

  • Rename column from n8n table :

- URL : https://yourn8naccount.app.n8n.cloud/rest/projects/{{ yourPorjectId}}/data-tables/{{ n8n_table_ID }}/columns/{{ n8n_column_ID }}/rename

- method : PATCH

- header :

{
"Cookie" : "{{ $json.headers[“set-cookie”][0] }}"
}

- payload :

{
"name":"newcol_updated"
}

To get the {{ n8n_column_ID }} just run below http request :

GET : https://yourn8naccount.app.n8n.cloud/rest/projects/{{ yourPorjectId}}/data-tables?filter={“projectId”:“{{ yourPorjectId}}”,“id”:“{{ n8n_table_ID }}”}

Response example with expected {{ n8n_column_ID }} => DiNjfl83CrrXXcoj

  • Delete column from n8n table :

- URL : https://yourn8naccount.app.n8n.cloud/rest/projects/{{ yourPorjectId}}/data-tables/{{ n8n_table_ID }}/columns/{{ n8n_column_ID }}

- method : DELETE

- header :

{
"Cookie" : "{{ $json.headers[“set-cookie”][0] }}"
}