Hi,
Is it possible to (optionally) include the 'summary' row to a table export? I have a use case where the client wants to download reports and of course wants the total sum included in the report.
Is there another way round this in the meantime?
Thanks, Jake
1 Like
Hello @Jake_Slack,
I understand your use case, and here’s a solution to include the summary row in your table export:
Add the Summary Row Programmatically Before Export
You can create a custom transformer or JavaScript query to append a summary row to your table data prior to exporting it. Below is an example implementation:
const tableData = table1.data ; // Replace with your table's data source
const summaryRow = {
column1: "Total",
column2: tableData.reduce((sum, row) => sum + row.column2, 0),
column3: tableData.reduce((sum, row) => sum + row.column3, 0),
// Add other columns as needed
};
return [...tableData, summaryRow];
Export the Modified Data
Use the transformed data to export the table, including the summary row:
utils.downloadFile("table_with_summary.csv", JSON.stringify(transformedData), "text/csv");
This approach ensures that the summary row is dynamically calculated and included in the exported file. If you have additional requirements or need further assistance, feel free to reach out! 
2 Likes
Great, thank you so much, I'll try that!
1 Like