Automatically Export to Excel

From Q
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:

Table Options Menu

See also