1
Get Values in Range
One script reply has been approved by the moderators Verified
Created by rossmccrann 842 days ago Viewed 10526 times
0
Submitted by rossmccrann Deno
Verified 842 days ago
1
type Gsheets = {
2
  token: string;
3
};
4
export async function main(
5
  gsheets_auth: Gsheets,
6
  spreadsheetId: string,
7
  range: string,
8
) {
9
  const token = gsheets_auth["token"];
10

11
  const GET_VALUES_URL = `https://sheets.googleapis.com/v4/spreadsheets/${spreadsheetId}/values/${range}`;
12

13
  const response = await fetch(GET_VALUES_URL, {
14
    method: "GET",
15
    headers: {
16
      Authorization: "Bearer " + token,
17
      "Content-Type": "application/json",
18
    },
19
  });
20

21
  return await response.text();
22
}
23