Refresh Slides Charts

A Slides deck with charts linked to a sheet shows yesterday's numbers until something refreshes them. refreshSlidesCharts(presentation) walks every slide, refreshes each Sheets-linked chart, and returns how many it refreshed.

When to use

  • Monday decks that pull numbers from a live sheet
  • A time-driven trigger that updates the deck before the meeting
  • After a script writes new summary values the charts depend on

How to use this snippet

/** * Refresh every Sheets-linked chart in a Slides presentation. * * @param {GoogleAppsScript.Slides.Presentation} presentation * @return {{refreshed: number, slides: number}} */ function refreshSlidesCharts(presentation) { var refreshed = 0; var slides = presentation.getSlides(); slides.forEach(function (slide) { slide.getSheetsCharts().forEach(function (chart) { chart.refresh(); refreshed++; }); }); return { refreshed: refreshed, slides: slides.length }; }

Example

function refreshMondayDeck() { var deck = SlidesApp.openById('YOUR_DECK_ID'); var result = refreshSlidesCharts(deck); Logger.log('Refreshed ' + result.refreshed + ' charts across ' + result.slides + ' slides'); }

Notes

  • Only charts inserted with Link to spreadsheet refresh this way. Pasted images of charts do not.
  • The script needs access to both the deck and the spreadsheet behind the charts.
  • Refresh does not rewrite placeholder text — pair with Replace Slide Tokens for that.

Happy Coding!

NitroGAS Chrome Extension

Want this snippet handy inside the Apps Script editor? NitroGAS gives you free snippets — plus optional Co-Pilot when you want a boost (Day Pass — $3, or 1-week, 1-month, or yearly passes — no subscription). Happy Coding!

Get the Extension