Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

114
Views
Discord bot acceses google sheet but its fetching an older version of it

So my discord bot has a command for doing something based on info from a google sheet. Now the problem is its reading an older version of the sheet rather than reading the live version. Code:

await doc.useServiceAccountAuth({
    // env var values are copied from service account credentials generated by google
    // see "Authentication" section in docs for more info
    client_email: process.env.CLIENT_EMAIL,
    private_key: process.env.PRIVATE_KEY.replace(/\\n/g, "\n"),
});
await doc.loadInfo();
const clanappsheet = doc.sheetsByIndex[1];
await clanappsheet.loadCells(`A1:Q${clanappsheet.rowCount}`);
const id = interaction.options.getString('id');
let row1 = 1;
let memberid = clanappsheet.getCell(row1, 11);
let member = memberid.formattedValue;
let memberclanassignment = clanappsheet.getCell(row1, 12);
while (memberid != null && member != id) {
    row1++;
    memberid = clanappsheet.getCell(row1, 11);
    member = memberid.formattedValue;
}
memberclanassignment = clanappsheet.getCell(row1, 12);

I want it to always read the live version of the sheet.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!