I’m creating a Discord bot. Whenever I use the command that this is linked to it works. However it displays all the data in all cells in the set range. How do I get a specific cell out of the range and use it?
The way I’ve been doing it is by replacing the range to a specific cell, but I feel like that isn’t the most practical way to do this.
Can anyone help? I’m pretty new to JS so any tips would be greatly appreciated.
async function readCerts() {
const sheets = google.sheets({
version: 'v4',
auth
});
const spreadsheetId = 'myIdHere';
const range = 'Overview!B5:H60';
try {
const response = await sheets.spreadsheets.values.get({
spreadsheetId,
range
});
const rows = response.data.values;
return rows;
} catch (error) {
console.error('error', error);
}
}
(async() => {
const pcc = await readCerts();
if (interaction.commandName === 'stats') {
const maar = new EmbedBuilder()
.setTitle('Statistics for Current Month')
//.setDescription('cool description here')
.setColor('Red')
.setThumbnail('https://i.imgur.com/9GKhYQf.png')
.setFooter({
text: 'DroneOS',
iconURL: 'https://i.imgur.com/9GKhYQf.png'
})
.setTimestamp()
.addFields({
name: `Total AARs: `,
value: `${raar}`,
inline: false,
});
interaction.reply({
embeds: [maar]
});
}
})()