Changing xlsx asset through code
-
I have seperate XLSX template files. I am wondering if I can have only one xlsx template and change its xlsx asset through code, based on a setting in the data. Because now i have one template for each xlsx asset..
-
Yes, you can use script to change the xlsx asset
async function beforeRender (req, res) { if (req.data.someCondition) { req.template.xlsx = { templateAssetShortid: '5Y5DP7j' } } else { req.template.xlsx = { templateAssetShortid: 'V1qhZuH' } } }