This is my HTML code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Qlik Sense Mashup</title>
<meta charset="utf-8">
<script src="https://pa-qliksense.aviv.gov.il/sense/app/8a9ba0aa-386b-423d-a0a5-a2305e1e7896"></script>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta http-equiv="cleartype" content="on">
<script src="../../resources/assets/external/requirejs/require.js"></script>
</head>
<body style="overflow: auto">
<!-- Extracting Qlik App ID and Object ID from URL parameters -->
<script>
const params_raw = window.location.search;
const params = new URLSearchParams(params_raw);
const qAppID = params.get("qlikAppID");
if (!qAppID) {
const err = "No Qlik app ID provided!";
alert(err);
throw err;
}
const qObjID = params.get("qlikObjectID");
if (!qObjID) {
const err = "No Qlik object ID provided!";
alert(err);
throw err;
}
</script>
<div id="CurrentSelections" class="qvobjects" style="position:relative; top:0; left:0; width:100%; height:38px;"></div>
<!-- Qlik Sense object placeholder -->
<div id="4ae44ca4-baee-4031-9d93-3b9895052f24"></div>
<!-- Automatically trigger export on page load -->
<script>
var prefix = window.location.pathname.substr(0, window.location.pathname.toLowerCase().lastIndexOf("/extensions") + 1);
var config = {
host: window.location.hostname,
prefix: prefix,
port: window.location.port,
isSecure: window.location.protocol === "https:"
};
require.config({
baseUrl: (config.isSecure ? "https://" : "http://") + config.host + (config.port ? ":" + config.port : "") + config.prefix + "resources"
});
require(["js/qlik"], function (qlik) {
qlik.setOnError(function (error) {
console.error('Error:', error);
alert('Error: ' + error.message);
});
// Open app using dynamically extracted Qlik App ID
var app = qlik.openApp(qAppID, config);
// Get table object using dynamically extracted Qlik Object ID
app.getObject(qObjID).then(function (model) {
// Create a table object
var table = qlik.table(model);
// Export data from the table
table.exportData({ download: true, format: 'OOXML' }).then(exportData => {
var blob = new Blob([exportData], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
var url = URL.createObjectURL(blob);
// Create a link element
var a = document.createElement('a');
a.href = url;
a.download = 'exported_data.xlsx'; // Set desired file name
// Trigger a click event on the link to initiate download
a.click();
// Release the object URL
URL.revokeObjectURL(url);
}).catch(error => {
console.error('Error exporting table data:', error);
alert('Error exporting table data. See console for details.');
});
}).catch(error => {
console.error('Error getting table object:', error);
alert('Error getting table object. See console for details.');
});
});
</script>
</body>
</html>
This is a code I wrote in the mash up of qlik sense dev hub mash up and this code I am supposed to type in the URL address application and object identifier and it is supposed to export to me a required object from an application in Excel format but in practice it does not export to me, can you please try to run this code and tell me what comes out to you? Thank you!