Create a new table with columns based on row values

You will need to use iterations and process groups of rows (corresponding to a table’s columns) of the original table one group after another.

For example, you can use the “Iterate table” action to iterate a module which gets a subset of rows related to one table, and pivots them into columns.

Gotchas:

  • Since the “Pivot” action sorts columns in alphabetical order, therefore in order to preserve the original column order you will need to temporarily use row numbers instead of column names.
  • The input dataset of the “Input” action is shown empty and assigned dynamically when the “Iterate table” action is executed. To populate it manually, go the “Iterate table” action (or the import action), right-click it and choose “Send to sandbox/module -> Module 1” . This will send a copy of the action’s dataset into the “Input” action of “Module 1”.

Here is an example that creates two excel files with columns as defined in Book1.xlsx. Notice that the order of columns in file “Tab 2” is reverse to “Tab 1”.
create-tables.morph (4.6 KB)
Book1.xlsx (9.7 KB)

Module "Main"
image

Module "Module 1"

1 Like