EXEC in PowerPointRun JavaScript in PowerPoint templates to compute values for slides.Oct 14, 2025Knowledge
InformationArticle BodyExamples Use Case 1: KPI metrics summary Aggregate important opportunity metrics for last week/this week with EXEC, store the results, and insert them into slide text boxes. Example data: { "Opportunities": [ { "Name": "Acme Corp - Expansion", "Stage": "Proposal/Price Quote", "Amount": 60000, "CloseDate": "2025-09-15", "Owner": "Jordan Lee" }, { "Name": "BrightWave Renewal", "Stage": "Negotiation/Review", "Amount": 45000, "CloseDate": "2025-09-17", "Owner": "Taylor Morgan" }, { "Name": "Zenith Inc. Pilot", "Stage": "Closed Won", "Amount": 75000, "CloseDate": "2025-09-08", "Owner": "Avery Smith" }, { "Name": "GlobalTech Services", "Stage": "Closed Won", "Amount": 90000, "CloseDate": "2025-09-09", "Owner": "Casey Brown" } ] } Exec tag value: {#! // Only treat "Closed Won" as closed const closedWonOpps = Opportunities.filter(opp => opp.StageName === "Closed Won"); const openOpps = Opportunities.filter(opp => opp.StageName !== "Closed Won"); // 1) Current pipeline size (all non-Closed Won) const pipelineCount = openOpps.length; const pipelineValue = openOpps.reduce((sum, opp) => sum + (opp.Amount || 0), 0); // 2) Closed Won in the last week (all Closed Won opps in the list) const closedWonCount = closedWonOpps.length; const closedWonValue = closedWonOpps.reduce((sum, opp) => sum + (opp.Amount || 0), 0); // 3) Closing in the next week (all open opps in the list) const closingNextWeekCount = openOpps.length; #} Template Document: Output: Use Case 2: Top performer determination Loop through salespeople and revenue to identify the highest performer and highlight them on an award slide. Example data: { "Opportunities": [ { "Name": "Acme Corp ΓÇô Pilot", "Stage": "Closed Won", "Amount": 5200, "CloseDate": "2025-09-08", "Owner": { "Name": "Katherine Stewart", "Title": "Senior Sales Representative", "Email": "kstewart@test.com", "Phone": "123-456-7890", "ProfilePic": "https://example.com/kstewart.png" } }, { "Name": "BrightWave Renewal", "Stage": "Closed Won", "Amount": 6500, "CloseDate": "2025-09-09", "Owner": { "Name": "Katherine Stewart", "Title": "Senior Sales Representative", "Email": "kstewart@test.com", "Phone": "123-456-7890", "ProfilePic": "https://example.com/kstewart.png" } }, { "Name": "Zenith Inc. Expansion", "Stage": "Proposal/Price Quote", "Amount": 30000, "CloseDate": "2025-09-15", "Owner": { "Name": "Jordan Lee", "Title": "Account Executive", "Email": "jlee@test.com", "Phone": "555-111-2222", "ProfilePic": "https://example.com/jlee.png" } } ]} Syntax: {#! // Step 1: Get all Closed Won opportunities const closedWonOpps = Opportunities.filter(opp => opp.StageName === "Closed Won"); // Step 2: Aggregate totals per owner const totalsByOwner = {}; closedWonOpps.forEach(function(opp) { const ownerKey = opp.Owner.Email; // use email as a unique key if (!totalsByOwner[ownerKey]) { totalsByOwner[ownerKey] = { Name: opp.Owner.Name, Email: opp.Owner.Email, Phone: opp.Owner.Phone, ProfilePic: opp.ProfilePic, Title: opp.Title, Amount: 0 }; } totalsByOwner[ownerKey].Amount += opp.Amount || 0; }); // Step 3: Find the top performer let topPerformer = null; for (const key in totalsByOwner) { const owner = totalsByOwner[key]; if (!topPerformer || owner.Amount > topPerformer.Amount) { topPerformer = owner; } } #} Template Document: Output: Notes Shapes that include only EXEC command will still exist in the final document. Commands run based on the order of shapes from back to front, to ensure EXEC commands run first for a slide, make sure that you right click on the shape containing the EXEC command and click "Send to Back". Next Steps About EXEC EXEC in Word EXEC in Excel EXEC in PDF TitleEXEC in PowerPointURL NameEXEC-in-PowerPoint