Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google apps script 谷歌应用程序脚本:运行脚本时,图表输出为';t正在生成_Google Apps Script - Fatal编程技术网

Google apps script 谷歌应用程序脚本:运行脚本时,图表输出为';t正在生成

Google apps script 谷歌应用程序脚本:运行脚本时,图表输出为';t正在生成,google-apps-script,Google Apps Script,我正在尝试连接html文件并使用一个doGet()输出它们,如下所示: 但是,图表不会生成。如果我通过Index.html传入一个文件,就会得到这个输出。这就是我在编辑器里写的代码 <html> <head> <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Tangerine"> <style> body { font-family: 'Tangerine',

我正在尝试连接html文件并使用一个doGet()输出它们,如下所示:

但是,图表不会生成。如果我通过Index.html传入一个文件,就会得到这个输出。这就是我在编辑器里写的代码

<html> <head> <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Tangerine"> <style> body { font-family: 'Tangerine', serif; font-size: 35px; } </style> <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> <script type="text/javascript"> // Load Charts and the corechart package. google.charts.load('current', {'packages': ['table']}); google.charts.load('current', {'packages':['corechart']}); google.charts.load('current', {'packages':['bar']}); google.charts.load('current', {'packages':['line']}); //Draw table for data google.charts.setOnLoadCallback(drawTable); //draw Line Chart for data google.charts.setOnLoadCallback(drawLineChart); //draw bar chart for data google.charts.setOnLoadCallback(drawBarChart); // Draw the pie chart for Date1 google.charts.setOnLoadCallback(drawApr1Chart); // Draw the pie chart for Date2 google.charts.setOnLoadCallback(drawApr3Chart); //Draw the pie chart for Date3 google.charts.setOnLoadCallback(drawApr10Chart); //Draw the pie chart for Date4 google.charts.setOnLoadCallback(drawApr24Chart); //draw the material line chart for all issues vs date when Charts is loaded google.charts.setOnLoadCallback(drawIssuesvsDate); function drawTable() 
body{font-family:'Tangerine',serif;font-size:35px;}//加载图表和corechart包。load('current',{'packages':['table']});load('current',{'packages':['corechart']});load('current',{'packages':['bar']});load('current',{'packages':['line']})//绘制数据表google.charts.setOnLoadCallback(drawTable)//绘制数据线图google.charts.setOnLoadCallback(drawLineChart)//为数据绘制条形图google.charts.setOnLoadCallback(DrubarChart);//为Date1 google.charts.setOnLoadCallback(drawApr1Chart)绘制饼图;//绘制Date2 google.charts.setOnLoadCallback(drawApr3Chart)的饼图//绘制Date3 google.charts.setOnLoadCallback(drawApr10Chart)的饼图//绘制Date4 google.charts.setOnLoadCallback(drawApr24Chart)的饼图//在加载图表google.Charts.setOnLoadCallback(DrawIssuseSvsDate)时,绘制所有问题与日期的物料折线图;函数drawTable()

不知道为什么会这样。我以前成功地连接了html输出,因此我不确定问题出在哪里。

在html文件中,在标记之前,放置以下内容:

<?!= HtmlService.createHtmlOutputFromFile('myFileName').getContent(); ?>

注意添加了.evaluate()

您的第一个解决方案有效。但是,我已经成功地在以前的项目中使用了您的第二个解决方案。我再次尝试使用第二个解决方案,但它输出了我在问题中显示的代码。这有什么原因吗?看看添加的编辑。我注意到include()函数有一个问题。我缺少的是.evaluate()。谢谢
<?!= HtmlService.createHtmlOutputFromFile('myFileName').getContent(); ?>
<?!= include('myFileName'); ?>
function include(filename) {
//  return HtmlService.createHtmlOutputFromFile(filename)
  return HtmlService.createTemplateFromFile(filename).evaluate()
      .getContent();
}