I am trying to do the following, unfortunately to no avail: 1. reading a spreadsheet and get it as a parsed object. 2. use the parsed object to look for a specific value in it. e.g an email.
The spreadsheet serves as a database and the motivation is to determine whether a given email exists there or not.
Apparently, I have misunderstood the use of asynchronous methods as I can't grasp how to return the.
The calling method:
helpers.read('the-spreadsheet-id', 'Sheet1!A:Z');
The reading method @ helpers/sheets.js:
exports.read = (spreadsheetId, range) => {
const sheets = google.sheets({ version: 'v4', auth: oAuth2Client });
return sheets.spreadsheets.values.get({
spreadsheetId,
range,
})
.then(_.property('data.values'));
};
what should I do in order to get a json object or similarly parsed data object to keep on working with at the calling method?
Thanks in advance.
helpers.readreturn? Are you getting the write data object back? Where are you stuck specifically?