Suche…


Einführung

Google appscript funktioniert gut als eigenständige Plattform und im Addon-Format für Google-Dokumente, -Bögen und -Formulare. Es gibt jedoch Situationen, in denen ein Client-Browser möglicherweise eine Google-App aufrufen muss, um eine Aktion auszuführen.

Daher hat Google clientseitige Anforderungen an Google-Apps-Skripts eingeführt. Um dieses Problem zu lösen, hat Google die clientseitigen Bibliotheken eingeführt

Dies ist ein Beispiel für einen clientseitigen Aufruf eines Google-App-Skripts

<script src="https://apis.google.com/js/api.js"></script>
<script>
function start() {
 // 2. Initialize the JavaScript client library.
 gapi.client.init({
'apiKey': 'YOUR_API_KEY',
// clientId and scope are optional if auth is not required.
'clientId': 'YOUR_WEB_CLIENT_ID.apps.googleusercontent.com',
'scope': 'profile',
}).then(function() {
// 3. Initialize and make the API request.
return gapi.client.request({
  'path': 'https://people.googleapis.com/v1/people/me',
  })
 }).then(function(response) {
console.log(response.result);
}, function(reason) {
console.log('Error: ' + reason.result.error.message);
});
};
// 1. Load the JavaScript client library.
 gapi.load('client', start);
</script>


Modified text is an extract of the original Stack Overflow Documentation
Lizenziert unter CC BY-SA 3.0
Nicht angeschlossen an Stack Overflow