How can I send res.data.values to another module.js? And how can I get it in module.js? The code below is a piece of the code provided by the following link: https://developers.google.com/sheets/api/quickstart/nodejs
The res.data.values take some time to response, so I believe this is my main problem and I don't know how to handle this.
function listMajors(auth) {
const sheets = google.sheets({version: 'v4', auth});
sheets.spreadsheets.values.get({
spreadsheetId: '1XrmHL0D8HCulZYaB_ocrYlpnvqP9cO0BTJ14wHTGLis',
range: 'Ficha',
}, (err, res) => {
if (err) return console.log('The API returned an error: ' + err);
const rows = res.data.values;
if (rows.length) {
console.log(rows)
} else {
console.log('No data found.');
}
});
}
