I thought that when I saw your script of str = str + '<td><button onclick=' + 'google.script.run.setApproved(' + '"<?= outputHandle[i][0] ?>"' + ')' + 'id="ldap">' + "Approve" + '</button>', it might be required to add a space between )i. So how about the following modification?
Modified script:
str = str + '<td><button onclick=' + 'google.script.run.setApproved(' + '"<?= outputHandle[i][0] ?>"' + ')' + ' id="ldap">' + "Approve" + '</button>'
or
str += '<td><button onclick=' + 'google.script.run.setApproved(' + '"<?= outputHandle[i][0] ?>"' + ')' + ' id="ldap">' + "Approve" + '</button>'
I can confirm that the above modification can be worked. And also, you can modify as follows.
str += '<td><button onclick="google.script.run.setApproved(\'<?= outputHandle[i][0] ?>\')" id="ldap">Approve</button>';
- I added
to ' id="ldap">'. It's from 'id="ldap">' to ' id="ldap">'.
- From your script of
'"<?= outputHandle[i][0] ?>"', it supposes that the value is string. Please be careful this.
Added:
And, when I saw your current script, I could understand your current issue of Uncaught SyntaxError: Unexpected token '<'. Unfortunately, your following script
str += '<td><button onclick="google.script.run.setApproved(<?= outputHandle[i][0] ?>)" id="ldap">Approve</button>';
cannot be used as the template. Because in your script, after the HTML data was loaded, the value is given to the above script by outputHandle of function onSuccess(outputHandle) {,,,}. So in this case, the scriptlet is not required to be used. I thought that this might be the reason for your current issue of Uncaught SyntaxError: Unexpected token '<'. In this case, please modify the above script as follows.
str += '<td><button onclick="google.script.run.setApproved(' + outputHandle[i][0] + ')" id="ldap">Approve</button>';
or
str += `<td><button onclick="google.script.run.setApproved(${outputHandle[i][0]})" id="ldap">Approve</button>`;
In this case, when the value of outputHandle[i][0] is the number value, the above modification can be used. But if the value of outputHandle[i][0] is the string value, please modify it as follows. Please be careful this.
str += `<td><button onclick="google.script.run.setApproved('${outputHandle[i][0]}')" id="ldap">Approve</button>`;