Untitled

mail@pastecode.io avatar
unknown
javascript
a year ago
719 B
2
Indexable
// Load the Google API Client Library
gapi.load('client', initialize);

// Initialize the Google API Client Library
function initialize() {
  gapi.client.init({
    apiKey: 'YOUR_API_KEY', // Replace with your API key
    clientId: 'YOUR_CLIENT_ID', // Replace with your client ID
    discoveryDocs: ['https://sheets.googleapis.com/$discovery/rest?version=v4'],
    scope: 'https://www.googleapis.com/auth/spreadsheets',
  }).then(function () {
    // Add an event listener to the button
    const button = document.getElementById('exportButton');
    button.addEventListener('click', exportTableToGoogleSheets);
  }).catch(function (error) {
    console.error('Google API Client initialization error:', error);
  });
}