Displaying chart from google sheet

My simple test program consists of a textbox to enter a range, a set_range button to set the range, a button
do_the_script to execute the script and the show_chart button to display the chart.
The script works as follows.
Deletes existing records in google sheet (courses_month) (from the second row) and adds records to courses_month according to the given range from another sheet that contains all the courses. The script works very quickly and correctly. On the PC, I can see all the rows and the graph at once. My goal is to quickly display the same graph in the application that I see on the PC screen.

I don't want to create a new chart in the target application every time to get the Id of the chart because it takes a long time.

The idea in the test application is to display the published chart using the webviewer and the link below.
I got this link from a published chart.

The chart should be displayed after finishing the script or after pressing the show_chart button.
And here my problems start. Sometimes the chart for the given range appears immediately (even without pressing the show_chart button)
and corresponds to the graph I see on the PC screen and sometimes some previously made graph is displayed. Interestingly, although the address to webviewer is the same (!), I can see previously generated charts by pressing the show_chart button multiple times.I don't understand it at all !
How to clear (?) the list of published charts so that there is only one recently created and this one is displayed?



Będę wdzięczny za pomoc i wszelkie sugestie

Published charts can be slow/inconsistent

Try this ?

I tried it . As i said earlier I don't want to create a new chart in the target application every time to get the Id of the chart because it takes a long time.
What about the idea I described ? How t
clear a list of published charts ?

The id of the chart remains the same....