2
Get Spreadsheet
One script reply has been approved by the moderators Verified
Created by rossmccrann 863 days ago Viewed 15473 times
0
Submitted by rossmccrann Deno
Verified 863 days ago
1
type Gsheets = {
2
  token: string;
3
};
4
export async function main(gsheets_auth: Gsheets, spreadsheetId: string) {
5
  const token = gsheets_auth["token"];
6

7
  const GET_SPREADSHEET_URL = `https://sheets.googleapis.com/v4/spreadsheets/${spreadsheetId}`;
8

9
  const response = await fetch(GET_SPREADSHEET_URL, {
10
    method: "GET",
11
    headers: {
12
      Authorization: "Bearer " + token,
13
      "Content-Type": "application/json",
14
    },
15
  });
16

17
  return await response.json();
18
}
19