Bot cant open Google Spreadsheets? Error 403
Hi, i'm quite new javascript and node and djs, I'm trying to make a slashCommand to see a spreadsheet however its not detecting? My code is below but the error message im getting is in the ss
I'v tried:
```
I'v tried:
- testing my slashCommand file(regionals.js) separately from fetchSheetData
- Giving my API key even though the spreadsheet is public
- not giving my API key
All have the same error code
- in: ./src/utils/sheetData.js
```
const baseSheetUrl = "https://sheets.googleapis.com/v4/spreadsheets/";
- Fetches data from a specific Google Sheets range.
- @param {string} SHEET_ID - The ID of the Google Sheet.
- @returns {Promise<Object>} - A promise that resolves to the sheet data.*/async function fetchSheetData() { const SHEET_ID = '1eqb7Zx7snlGYnRAPsd2uky7slXx5BhaAkfu2ZTWtUdg'; // you can find this in the URL at https://docs.google.com/spreadsheets/d/-->SHEET_ID<--/edit?gid=0#gid=0 const sheetTab = "WEEK1-CanadianPacific"; // The sheet tab is on the bottom left const range = `${sheetTab}!B7:B16,E7:E16`; const fetch = (await import("node-fetch")).default; const sheetUrl = `${baseSheetUrl}${SHEET_ID}/values/${range}?key=${require("../../config.json").API_KEY}`; // an API key is not needed if anyone with the link can view const response = await fetch(sheetUrl, { method: "GET", headers: { accept: "application/json", }, }); if (!response.ok) { console.error(`Failed to fetch data: ${response.status} ${response.statusText}`); throw new Error("Failed to fetch data from Google Sheets."); } return response.json();}
```
