Get Spreadsheet

bun · 21 lines
1
//native
2
 
3
type Gsheets = {
4
  token: string;
5
};
6
export async function main(gsheets_auth: Gsheets, spreadsheetId: string) {
7
  const token = gsheets_auth["token"];
8
 
9
  const GET_SPREADSHEET_URL = `https://sheets.googleapis.com/v4/spreadsheets/${spreadsheetId}`;
10
 
11
  const response = await fetch(GET_SPREADSHEET_URL, {
12
    method: "GET",
13
    headers: {
14
      Authorization: "Bearer " + token,
15
      "Content-Type": "application/json",
16
    },
17
  });
18
 
19
  return await response.json();
20
}
21
 
Orvanta Hub — community scripts, flows, apps & resource types.