capabilities.work

Add and Retire a Table Column

A 6-step recipe with Microsoft Excel. We can help you get access.

Recipe · 6 steps

Add and Retire a Table Column

Add a column to an Excel table, confirm the new schema, and retire the column.

  1. Open a persisting session so the schema change is committed to the workbook.
  2. Resolve the table on the worksheet whose schema is being changed.
  3. Capture the table's column set before the change so the caller has the prior schema and can pick a valid insert index.
  4. Insert the new column at the requested index, carrying its header and seed values. Columns to the right of the index shift over by one.
  5. Re-read the columns to confirm the new schema, which is the shape every subsequent row append must now match.
  6. Delete the column that was just added, demonstrating the retire path. This destroys every value in the column and cannot be undone through the API.
What you'll need to have ready
  • itemId: The drive item id of the workbook file.
  • worksheetIdOrName: The worksheet holding the target table.
  • columnValues: A two-dimensional array holding the new column, with the header as the first entry (e.g. [["Status"], ["Open"], ["Closed"]]).
  • index: The zero-based position to insert the new column at.
For your developer

Arazzo workflow microsoft-excel:table-column-lifecycle, 6 operations: createWorkbookSession → listTables → listTableColumns → addTableColumn → listTableColumns → deleteTableColumn. Specs on APIs.io.