Data Export for specific sales invoice

Hi,
I need to use this button to download a direct download Excel file for specific data,

What is a built-in function I use for this?

Any help ?

I try this code, but not working

make_export: function () {

		var me = frappe.query_report;
		me.title = me.report_name;

		if (!frappe.model.can_export(me.report_doc.ref_doctype)) {
			frappe.msgprint(__("You are not allowed to export this report"));
			return false;
		}

		frappe.prompt({
				fieldtype: "Select",
				label: __("Select File Type"),
				fieldname: "file_format_type",
				options: "Excel\nCSV",
				default: "Excel",
				reqd: 1
			},
			function (data) {
				var view_data = frappe.slickgrid_tools.get_view_data(me.columns, me.dataView);
				var result = view_data.map(row => row.splice(1));

				// to download only visible rows
				var visible_idx = view_data.map(row => row[0]).filter(sr_no => sr_no !== 'Sr No');

				if (data.file_format_type == "CSV") {

					// ...
					//Modify CSV output here (`result` variable)
					// ...

					frappe.tools.downloadify(result, null, me.title);
				} else if (data.file_format_type == "Excel") {
					try {
						var filters = me.get_values(true);
					} catch (e) {
						return;
					}
					var args = {
						cmd: 'frappe.desk.query_report.export_query',
						report_name: me.report_name,
						file_format_type: data.file_format_type,
						filters: filters,
						visible_idx: visible_idx,
					}

					open_url_post(frappe.request.url, args);
				}
			}, __("Export Report: " + me.title), __("Download"));

		return false;
	}

@Omar_Mohammed Look around how Data export work with selecting filters and it will only return excel / csv data of matched filter.

might be helpful

I don’t know in which is frappe or erpnext, becuase it’s a little complex.