Search... Ctrl + K

Get Values (gsheets)
One script reply has been approved by the moderators Verified

Created by rossmccrann 127 days ago Used 29 times 1 Point

No comments yet

Points: 0
deno
One script reply has been approved by the moderators
Ap­pro­ved
import * as wmill from "https://deno.land/x/windmill@v1.23.0/mod.ts";

export async function main(
    gsheets_auth: wmill.Resource<"gsheets">,
    spreadsheetId: string,
    worksheet_name: string
) {
    const token = gsheets_auth["token"];

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

    const response = await fetch(GET_VALUES_URL, {
        method: "GET",
        headers: {
            Authorization: "Bearer " + token,
            "Content-Type": "application/json",
        },
    });

    return await response.text();
}

Submitted by rossmccrann 127 days ago

Edited 127 days ago

No comments yet