Export to excel based on the filters selected.

I need to add a script on the button that will help me download excel based on the filter values selected.

I used the below script but still, I am getting all data instead of filtered one. Can anyone help me out with this? How can achieve this?

var excelOptions =
appendDateToFileName: false,
overrideFileName: false,
openOnCompletion: true,
enableOverlay: false,
selection: dundas.export.ExportSelection.MULTIPLE_ITEMS,
includeParameterValues: true,
adapterIds: “93de4ef2-2538-cd19-492b-21ff9bf20fef”


Hi Anupam,

I found this somewhere and hope it helps you for exporting data to excel based on filter values selected. Make sure to change this part to whatever the script name is for your table/visual you are exporting data from. parameterValue.values = [ ExportTable.id ];

// Get the export service.
var exportService = this.getService(‘ExportService’);

// Get the view service.
var viewService = this.getService(‘ViewService’);

// Create the export request.
var exportRequest =
new dundas.export.ExportRequest(
isLegacyExport: true,
// Export Excel
providerId: dundas.constants.STANDARD_EXCEL_EXPORT_PROVIDER_ID,
viewData: this.getService(“CanvasService”).canvas.viewModel.businessObject.control

// Create parameter value to pass to the request.

var parameterValue = new dundas.data.CollectionStringValue();
parameterValue.parameterId = dundas.constants.EXCEL_ADAPTERS_ID;
parameterValue.values = [ ExportTable.id ];

//Multiple select

var parameterValue = new dundas.data.SingleNumberValue();
parameterValue.parameterId = dundas.constants.EXCEL_EXPORT_SELECTION_ID;
parameterValue.value = 3 ;

//Include parameters

var parameterValue = new dundas.data.SingleBooleanValue;
parameterValue.parameterId = dundas.constants.EXCEL_INCLUDE_PARAMETERS_ID;
parameterValue.value = true;

//On the left

var parameterValue = new dundas.data.SingleNumberValue();
parameterValue.parameterId = dundas.constants.EXCEL_PARAMETER_VALUES_LOCATION_ID;
parameterValue.value = 2;

//Append date to file name

var parameterValue = new dundas.data.SingleBooleanValue;
parameterValue.parameterId = dundas.constants.APPEND_DATE_TO_FILE_NAME_ID;
parameterValue.value = true;

// Get the perform export promise.
var exportPromise =

// Setup a loading dialog.

// Get the Url for the export file.
var exportFileUrl =

  	// Force the browser to download the file.



Solved via email. The sample scripts provided in export articles should simply work in this case because export functionality exports what is seen in the UI.