Hello everybody,
I’m creating a new extension for my app to read metadata from a Google Spreadsheet document.
Everything seems to be working yet I need the clientside to receive the response that is being displayed only on the serverside now.
const { google } = require('googleapis');
exports.spreadsheetGoogle = async function (options) {
let response = {};
const auth = new google.auth.GoogleAuth({
keyFile: "./extensions/server_connect/modules/googleCredentials/credencialesSpreadsheet.json",
scopes: "https://www.googleapis.com/auth/spreadsheets",
});
// Create client instance for auth
const client = await auth.getClient();
// Instance of Google Sheets API
const googleSheets = google.sheets({
version: "v4",
auth: client
});
const spreadsheetId = "1ig4pGOX0Q0GHL5qcYNQbi9wpYwOMw_gsTwLFeDG9RPY";
// Get metadata about spreadsheet
const metaData = await googleSheets.spreadsheets.get({
auth,
spreadsheetId,
});
response.metaData = metaData;
console.log(response);
return response;
}
The return response is not working, I’m not getting the data on my browers, yet the server output shows the data correctly (with the console.log).
I’ve already created an extension myself and using response I could see the data on my clientside. Why I can’t do that now? I’m missing something.
Thanks!
Community Page
Last updated:
Last updated: