Question

In Rally we have a custom App which displays a table. Is there a way to export this table to Excel?

Was it helpful?

Solution

Rally Add-in for Excel looks good, but it only works for Office 2010 and we are stuck on 2007. But I did find this solution that's simple and it works in Firefox. Added a button to the app, when clicked I pass in the div_id of the table along with a Title.

var tableToExcel = (function() {
      var uri = 'data:application/vnd.ms-excel;base64,'
        , template = '<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40"><head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--></head><body><table>{table}</table></body></html>'
        , base64 = function(s) { return window.btoa(unescape(encodeURIComponent(s))) }
        , format = function(s, c) { return s.replace(/{(\w+)}/g, function(m, p) { return c[p]; }) }
      return function(table, name) {
        if (!table.nodeType) table = document.getElementById(table)
        var ctx = {worksheet: name || 'Worksheet', table: table.innerHTML}
        window.location.href = uri + base64(format(template, ctx))
      }
    })();

var onClicked = function(sender, eventArgs) {
    var buttonValue = eventArgs.value;
    tableToExcel('mashup_table', 'Reviews Report Table');
};

OTHER TIPS

Currently there is no way to export data from a table in an App.

Have you seen the Rally Add-in for Excel?

Michael,

You can try and use the data URI scheme to make your export work. It is possible to get the data from a AppSdk table and creating a comma delimited string. You could then make one of the special URIs to download the contents as a .csv and open them in excel.

We have been kicking around the idea of making the SDK be able to export it's data to from their components but the lack of constant support for data URIs has been a blocking point. I don't know what browsers you have to support internally but that may be a nice start for a client side solution.

Here is a solution that works with ExtJs that you may find useful.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top