[Table.Save:]
Stores the previous table in a new tab in XLSX output documents.
Purpose
Use the [Table.Save:] macro to store the previous table in a new tab in XLSX output documents.
Macro Compatibility
The macro can be used in the highlighted input document types only. A greyed-out icon indicates not supported.
Usage
The new tab will have name
Parameter | Type | Deprecation Message | Preferred Parameter | Presence | Purpose | Options | Default |
---|---|---|---|---|---|---|---|
String | Deprecated | worksheetName | The name of the worksheet in the XLSX document. Also used for the table name, unless one is specified. Excel does not allow blank names, names above 31 characters, and the following characters: :, /, \, ?, *, [, ] | N/A | N/A | ||
String | Deprecated | worksheetName | The name of the worksheet in the XLSX document. Also used for the table name, unless one is specified. Excel does not allow blank names, names above 31 characters, and the following characters: :, /, \, ?, *, [, ] | N/A | N/A | ||
String | Use instead of:
| Mandatory | The name of the worksheet in the XLSX document. Also used for the table name, unless one is specified. Excel does not allow blank names, names above 31 characters, and the following characters: :, /, \, ?, *, [, ] | N/A | N/A | ||
List<String> | Optional | When used, only the specified column names (values in the first row) will be saved and in the specified order. An error will be generated if any of the specified columns do not exist in the original table. Do not use with tables that have merged cells or the results will be unpredictable (or an error may occur). Specify multiple columns joined by a semi-colon e.g. columns=Column A;Column B | N/A | N/A | |||
String | Optional | Add a comment to make your document template more readable. The comment is discarded in the output document. | N/A | N/A | |||
String | Optional | The text for the single cell (default A1 unless changed with 'firstCellName') in the new tab in the XLSX document if the table is empty. No formatting is applied. A header row only is considered an empty table. | N/A | N/A | |||
Boolean | Optional | Should NCalc expression evaluation throw error on Overflow |
|
true | |||
List<String> | Optional | When used, the specified columns names (values in the first row) or any that remain if 'columns' is used, are removed. An error will be generated if any of the specified columns do not exist in the original table (or, if 'columns' was used, those that do not exist in the columns that remained). Do not use with tables that have merged cells or the results will be unpredictable (or an error may occur). Specify multiple columns joined by a semi-colon e.g. excludeColumns=Column A;Column B | N/A | N/A | |||
String | Optional | The text to display should the macro fail to execute. Note that a poorly-specified macro (e.g. omitting mandatory parameters) will still result in an error message. | N/A | N/A | |||
String | Optional | The first cell name (the position of the upper-left cell of the table), such as A5. Note: Excel has a maximum of 1,048,576 rows and 16,384 columns (cell XFD1048576), and you should take into account the number of columns expected in the output table. | N/A | A1 | |||
Boolean | Optional | Whether to hide grid lines (for both View and Print modes) in the worksheet. In an XLSX document, each worksheet can have different settings for this. In Excel, these settings can be found in Page Layout -> Gridlines. |
|
false | |||
String | Optional | The condition that must be true in order for the macro to be executed/evaluated. Must either evaluate to true or false, for example: "3+5=8" or "contains('abcd', 'z'). | N/A | true | |||
Int32 | Optional | The percentage size of images in tables when 'saveAsExcelTable' is true. Useful to tweak output image sizes in cells. |
|
100 | |||
MacroMode | Optional | The mode in which variables are stored. In the legacy mode (default for Schedules), the variable created is a string and formatted. In the normal mode (default for Report Studio), the output variable is stored as a strongly-typed object, e.g. an Int32 or a List |
|
Legacy | |||
ObfuscationType | Optional | Obfuscation type. Use obfuscation to write reports where sensitive data is hidden. When used, ReportMagic guarantees that the same input string will map to the same output string for the whole of the report (but the next time the report runs, it will most likely map to a different value). If you use obfuscation, the property in your macro will not show up and instead, you will see a fake item of the obfuscation type chosen. |
|
None | |||
Boolean | Optional | Whether to save as an actual Excel table. This should be set to false if the input table contains merged cells. ReportMagic will automatically set this to false if any merged cells are encountered. This also lets you have column headings with the same values (normally not allowed in a proper table). |
|
true | |||
String | Optional | The name of the table in the XLSX document. Table names must be unique across all worksheets (for example, you cannot have a table called 'table1' in worksheet A and another table called 'table 1' in worksheet B). When 'saveAsExcelTable' is false, this parameter is ignored. | N/A | N/A | |||
String | Optional | If specified, adds a warning message for this macro. This is processed as an NCalc, and the warning message will ALWAYS be present and will be the value of the evaluated NCalc expression. | N/A | N/A | |||
XlsxTableStyle | Optional | The XLSX table style to use. This is ignored when 'saveAsExcelTable' is false. |
|
TableStyleMedium13 |
Examples (5)
Example 1:
Saves the last table:
[Calculate: value=`list(list('Month', 'London', 'Manchester', 'Cardiff', 'Newcastle'), list('October', 1, 2, 3, 4), list('September', 5, 6, 7, 8))`, =>Values][List.Table: values={=Values}][Table.Save: worksheetName=My Worksheet Name 1]
Example 2:
Saves the last table and hides the grid lines:
[Calculate: value=`list(list('Month', 'London', 'Manchester', 'Cardiff', 'Newcastle'), list('October', 1, 2, 3, 4), list('September', 5, 6, 7, 8))`, =>Values][List.Table: values={=Values}][Table.Save: worksheetName=My Worksheet Name 2, hideGridLines=true]
Example 3:
Saves the last table and inserts at a specific cell:
[Calculate: value=`list(list('Month', 'London', 'Manchester', 'Cardiff', 'Newcastle'), list('October', 1, 2, 3, 4), list('September', 5, 6, 7, 8))`, =>Values][List.Table: values={=Values}][Table.Save: worksheetName=My Worksheet Name 3, firstCellName=B2]
Example 4:
Saves the last table but includes specific columns:
[Calculate: value=`list(list('Month', 'Priority', 'Assignee', 'Date', 'Amount'), list('October', 1, 2, 3, 4), list('September', 5, 6, 7, 8))`, =>Values][List.Table: values={=Values}][Table.Save: worksheetName=My Worksheet Name 4, columns=Date;Amount]
Example 5:
Saves the last table but excludes specific columns:
[Calculate: value=`list(list('Month', 'Priority', 'Assignee', 'Date', 'Amount'), list('October', 1, 2, 3, 4), list('September', 5, 6, 7, 8))`, =>Values][List.Table: values={=Values}][Table.Save: worksheetName=My Worksheet Name 5, excludeColumns=Priority;Assignee]