Using a Snippet to Export to Excel

I am trying to use a snippet and a custom button to export model data to excel but I have a couple things I am stuck on. I am mainly doing this because I want to export fields that are outside my table but do not want to append the record id. It seems I can’t do both point and click.

1. When using a snippet, how do I add custom labels to the fields? Is this possible?

2. When using this method it seems I lose the functionality of selecting which rows I want to export. Is this true? Can you only export all rows?

Here’s my sample snippet:

var model = skuid.model.getModel(‘Estimates’);

  fileName: ‘All_Estimates’,

  fields: [






  doNotAppendRowIdColumn: true,


Hi Ryan

Try this:

var $ = skuid&#46;$;<br /><br />var model = skuid&#46;model&#46;getModel('Estimates'),<br /> TABLE_UNIQUE_ID = 'yourTableId',<br /> list = skuid&#46;$('#'+TABLE_UNIQUE_ID)&#46;data('object')&#46;list,<br /> selectedRows = skuid&#46;$&#46;map(list&#46;getSelectedItems(),function(item){ <br /> return item&#46;row; <br /> });<br /><br />var estName = model&#46;getField('Estimate__r&#46;Name'),<br /> estDesc = model&#46;getField('Estimate__r&#46;Description__c');<br />estName&#46;label = 'yourlabel';<br />estDesc&#46;label = 'yourlabel';<br /><br />model&#46;exportData({<br /><br /> fileName: 'All_Estimates',<br /><br /> fields: [<br /> estName,<br /> estDesc<br /> ],<br /><br /> rows: selectedRows,<br /> <br /> doNotAppendRowIdColumn: true,<br /><br />});

Add the rest of your fields to the code.

This will export all rows, which you selected in the table (Like a mass action).

Hope that helps…

Thank you!