LogiExport Now supports Qlik Sense® Enterprise SaaS

Macro-like feature: most useful LogiExport function

Macro-like feature: meet the most useful LogiExport function

LogiExport has a Macro-like feature, that allows you to easily create any adjustments to the file, and LogiExport will still generate a standard Xlsx file.

Use this feature to save time and automate your work by implementing Macros to the final file.

The API functionality is based on this Open Source Library, and you can use  all of its functionality using the API code.

You can also use the following scope variables in your code:

• workbook = the Workbook object, Example:  

// Find all occurrences of the text “foo” in the workbook and replace with “bar”.
workbook.find(“foo”, “bar”);

• sheet = the WorkSheet object, Example: 

// Set tab Color
sheet.tabColor(“0000ff”);

• tableRange = a Range object that contains the data table rangeExample: 

// Set the font size for all table
tableRange.style(“fontSize”, 12)

API Snippets for LogiExport Macro-like feature

Below are some examples:

1. How to turn your headers sideways: 

				
					='headerRange.style("textRotation",45)' 
				
			

2. Add grouping headers to table: 

API: 

				
					='sheet.range(DataFirstLine-1, 6, DataFirstLine-1, 8).value("Measures").style("border",true).style("borderColor","86ff24").style("fill","eaffd9").merged(true)'
				
			

 

3. Merge fields by value in table: 

API:

				
					='var columnsToMerge = 5; 

var mergeRange = function(startRow, endRow, colIdx) { 

    var prevVal = ""; 

    sheet.range(startRow, colIdx, endRow + 1, colIdx).forEach(function(cell) { 

        var rownum = cell.rowNumber(); 

        if ((cell._value != prevVal && prevVal != "") || rownum == endRow + 1) { 

            sheet.range(startRow, colIdx, rownum - 1, colIdx)
           .style("verticalAlignment","center")
           .style("wrapText",true) 
           .style("horizontalAlignment","center")
           .merged(true); 

            if (colIdx < columnsToMerge) { 
                mergeRange(startRow, rownum - 1, colIdx + 1); 
            } 
            
            startRow = rownum; 
        } 
        
        prevVal = cell._value; 
    }); 
} 

mergeRange(tableRange._minRowNumber + 1, tableRange._maxRowNumber, 1); 
'