本文介绍了如何自动更新链接到Google表格的图表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Google幻灯片演示文稿,其中的图表链接到特定的Google表格电子表格。

I have a Google Slides presentation with charts that are linked to a specific Google Sheets Spreadsheet.

由于演示文稿中有很多图表,我正在寻找一种更新方法所有这些链接的图表自动生成,或者至少一次全部显示。

As there are many charts in the presentation, I'm looking for a way to update all these linked charts automatically, or at least all of them at once.

执行此操作的最佳方法是什么?

What is the best way to do this?

推荐答案

您可以使用以下脚本在幻灯片UI的下拉菜单中添加自定义函数。这将从当前演示文稿中获取幻灯片,进行循环浏览,获取每张幻灯片中的任何图表并刷新(更新)它们。

You can add a custom function to a dropdown menu in the Slides UI with the following script. This gets the slides from the current presentation, loops through them, gets any charts in each slides and refreshes (updates) them.

function onOpen() {
  var ui = SlidesApp.getUi();
  ui.createMenu('Custom Menu')
  .addItem('Batch Update Charts', 'batchUpdate')
  .addToUi();
}

function batchUpdate(){

  var gotSlides = SlidesApp.getActivePresentation().getSlides();

  for (var i = 0; i < gotSlides.length; i++) {
    var slide = gotSlides[i];
    var sheetsCharts = slide.getSheetsCharts();
    for (var k = 0; k < sheetsCharts.length; k++) {
      var shChart = sheetsCharts[k];
      shChart.refresh();
    }
  }
}

注意:要更新的功能/ refresh链接的幻灯片在此响应时似乎不存在。

Note: The functionality to update/refresh linked Slides doesn't appear to exist at the time of this response.

这篇关于如何自动更新链接到Google表格的图表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-17 14:05