When loading a Grapher template from Scripter, how do I use different worksheets for different curves?

This article provides a script snippet for loading a graph with a template and then changing the worksheet for a plot using Grapher's Scripter program.


When loading a template from a script, only one worksheet can be named in the Open command. After the template is opened, each curve can be selected and the worksheet used can be changed. This example shows how to load the template with one worksheet and change the worksheet for one curve. The first curve ("Line/Symbol Plot 1") will still use the worksheet named in the Open command line.


'Opens Template 
Set Plot = GrapherApp.Documents.Open ("c:\path\filename.grt", "c:\path\filename.dat") 
'Change worksheet of curve 2 
Dim Graph1, Line2 As Object
Set Graph1 = Plot.Shapes.Item(1)
Set Line2 = Graph1.Plots.Item(1)
Line2.worksheet = ("c:\path\filename2.dat") 


Updated October 9, 2018

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request


Please sign in to leave a comment.