Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
326 views
in Technique[技术] by (71.8m points)

javascript - 有没有一种使用Google Apps脚本渲染图像的方法?(Is there a way to render an image using Google Apps Script?)

I'd like to generate a graphic using data from a Google Sheets spreadsheet and then embed that graphic in a Google Document.(我想使用Google表格电子表格中的数据生成图形,然后将该图形嵌入Google文档中。)

There are lots of libraries to do this however they either require access to the DOM or node.js.(有许多库可以执行此操作,但是它们需要访问DOM或node.js。) The graphic isn't supported by the chart API.(图表API不支持该图形。) As I understand it neither of these are available in the Google apps script environment.(据我了解,这些都不在Google Apps脚本环境中可用。) Is there a way to create custom graphics in google apps script?(有没有一种方法可以在Google Apps脚本中创建自定义图形?)   ask by Peter Kelley translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You could try setting up a function on Apps Script to generate the graph and then insert it into the document using the method appendImage() like:(您可以尝试在Apps脚本上设置一个函数来生成图形 ,然后使用appendImage()方法将其插入文档中,例如:)

docs.getBody().appendImage(chart); To create a custom chart from Apps Script you could use the Chart API(要通过Apps脚本创建自定义图表,您可以使用Chart API)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...