Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Export pivot table to Excel in Qliksense mashup

Goodmorning Qlik Community,

I would know if there is a way to export a pivot table object to Excel...I've toke a look to api reference

(exportData method ‒ Qlik Sense)

but I can't understand in which way I can create a qTable from Pivot object.

Thanks for help...

6 Replies
idogridish2
Creator II
Creator II

Same here,

if someone can provide an explanation about the cod below and how to implement it it would be excellent,

exportData method ‒ Qlik Sense

*****************************************js*******************************************

var qTable = qlik.table(this); 

var $exportButton = $( document.createElement('button')); $exportButton.html('Export'); $exportButton.bind('click', function (  ) { qTable.exportData({download: true}); });

$element.append($exportButton);


******************************************html******************************************


<button ng-click="table.exportData({download:true})">Create Excel file</button>


s29124141
Partner - Creator II
Partner - Creator II

You can export the data using one of the below methods.

Method 1 :- Pass the html element id ('QV06') and qlik sense object id ('uETyGUP') as shown below.

require(["js/qlik"], function (qlik) {

  app.getObject('QV06', 'uETyGUP').then(function (visual) {

  var qTable = qlik.table(visual);

  qTable.exportData({ download: true });

  });

});

Method 2 :- Create table by passing the hypercube dimensions and measured and export the table.

// Get current app. 

var app = qlik.currApp($('#QV01')); 

 

 

// Create table using table API. 

var table = app.createTable([{ "qDef": { "qFieldDefs": ["Case Owner Group"], "qFieldLabels": ["Group"] } }, 

                            { "qDef": { "qFieldDefs": ["CaseNumber"], "qFieldLabels": ["CaseNumber"] } } 

                            ], 

  [{ "qDef": { "qDef": "Sum( [Open Cases] )", "qLabel": "Open Cases" } }], 

  { rows: 200 }); 

 

 

// Create OnData listener for the table object. 

var listener = function () { 

  debugger; 

  table.exportData({ download: false }, function (link) { 

  var url = (config.isSecure ? "https://" : "http://") + config.host + (config.port ? ":" + config.port : "") + link 

  window.open(url, "_blank");

  table.OnData.unbind(listener); 

  }); 

}; 

 

 

// Bind the listener to the table object. 

table.OnData.bind(listener); 

tellmalaika17
Contributor II
Contributor II

Hi Praveena,

I am trying to add a mouse over on export excel icon. I have used exactly the script that you have provided here and export to excel works fine however I am unable to add mouse over on it.

Appreciate your help.

s29124141
Partner - Creator II
Partner - Creator II

The problem mentioned in the original issue is about Export of data to excel, which works fine for you. The mouse over problem you have mentioned does not look related to Qlik. You can research on how to bind mouse over event listeners in the language or platform of your development.

If you are using jquery then you can follow https://api.jquery.com/mouseover/ or if you are using Angular/React then it varies.

tellmalaika17
Contributor II
Contributor II

Thanks for your prompt response. Mouse over is in mash up Qlik Sense. I am not familiar with jquery and javascript hence if you know how to add mouse over in javascript in the same line of script where export to excel has been added. Thanks for your help.

munna1317
Creator II
Creator II

Hello All ,

Could please let me know all color coding in pivot will be export to excel or not. 

 

Thanks in Advance, 

 

Harish