J'essaie d'accéder aux informations de ma feuille de calcul selon le code ci-dessous et j'ai cette erreur dont je ne comprends pas bien la raison.
J'ai déjà donné mon accord pour l'email d'identification sur google ...
const { google } = require("googleapis");
const creds = require("./config/gCredentials.json");
const client = new google.auth.JWT(
creds.client_email,
null,
creds.private_key,
["https://www.googleapis.com/auth/spreadsheets"]
);
client.authorize(function (err, tokens) {
if (err) {
console.log(err);
} else {
console.log("connected");
gsrun(client);
}
});
async function gsrun(cl) {
const gsapi = google.sheets({ version: "v4", auth: cl });
const opt = {
spreadsheetId: "XYZ",
range: "SheetA!A1:B14",
};
let data = await gsapi.spreadsheets.values.get(opt);
console.log(data);
}
Une idée de ce que cela pourrait être ?
Console d'erreur
connected
(node:31301) UnhandledPromiseRejectionWarning: Error: This operation is not supported for this document
at Gaxios.<anonymous> (****/node_modules/googleapis/node_modules/gaxios/build/src/gaxios.js:73:27)
at Generator.next (<anonymous>)
at fulfilled (****/node_modules/googleapis/node_modules/gaxios/build/src/gaxios.js:16:58)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:31301) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:31301) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.