Automatically Export to Excel
Jump to navigation
Jump to search
From version 5.5.1, it is possible to export groups, tables, plots and R outputs to Excel via QScript using the exportToExcel command. This provides the same functionality as using the Table Options menu when exporting to Excel as Excel (fast). Below is an example of QScript code for exporting each table group in your Report tree into separate Excel files using the name of the group folder:
var location = "C:\\Users\\oliverh\\Desktop\\" //Use double slashes for folder paths
project.report.subItems.forEach(function (item) {
item.exportToExcel(location + item.name + '.xlsx', {
table_style: 'TableStyleLight13',
include_table_of_contents: true,
table_names_sequential: true,
ignore_net_and_sum: true,
show_significance_arrows: false,
export_tables_as: 'OneWorksheetPerTable',
});
});
The settings used above are the same as the selected Table Options below:
See also
- QScript for an explanation of how to run this code.
- QScript Examples Library for other examples.
- QScript Reference for technical information.
- JavaScript for information about the JavaScript programming language.
- Table JavaScript and Plot JavaScript for tools for using JavaScript to modify the appearance of tables and charts.
- JavaScript Variables for detail on how to create new variables in the Variables and Questions tab using JavaScript.