Embedding a Chart to a Cell using Custom Function on Spreadsheet
This sample script embeds a chart to a cell using custom function on Spreadsheet.
I think that this method is one of various ideas.
Problem
When you want to create a chart and embed it to a cell using custom functions, you notice that insertChart() cannot be used. There are some limitations for using custom functions. But insertChart() creates floating charts. So in order to embed a chart to a cell, the function =IMAGE() is suitable for this situation. Here, setFormula() for setting =IMAGE() and DriveApp.createFile() for creating images from charts also cannot be used for custom functions.