I want to call Apps Script function from Golang.
I can send the Parameter from Golang but cannot make it work in runMyFunction
. If I add return myParameter;
- I can see the parameter I am passing but using it inside SQL to BigQuery is not working. I am getting undefined
var sql = ' SELECT column1, column2 ' +
' FROM dataset.mytable WHERE SUBSTR ( column1) = "'
+ myParameter + '" ;'
function runMyFunction(myParameter) {
...
return myParameter;
}
runMyFunction
type Message struct {
myParameter string
}
m := Message{"1234"}
a := make([]interface{}, 1)
a[0] = m
req := script.ExecutionRequest{Function: "runMyFunction",
Parameters: a,
DevMode: true}
// Make the API request.
resp, err := srv.Scripts.Run(scriptID, &req).Do()
Actually this is the right solution:
a := []interface{}{"1234"}
req := script.ExecutionRequest{Function: "runMyFunction",
Parameters: a,
DevMode: true}