import * as wmill from "https://deno.land/x/windmill@v1.24.1/mod.ts";
export async function main(gsheets_auth: wmill.Resource<"gsheets">,
spreadsheetId: string,
range: string,
values: Array<any>,
) {
const token = gsheets_auth["token"];
const valueInputOption = 'USER_ENTERED';
const APPEND_ROWS_URL =
`https://sheets.googleapis.com/v4/spreadsheets/${spreadsheetId}/values/${range}:append?valueInputOption=${valueInputOption}`;
const body = {
"range": range,
"majorDimension": "ROWS",
"values": [values],
};
const response = await fetch(APPEND_ROWS_URL, {
method: "POST",
body: JSON.stringify(body),
headers: {
Authorization: "Bearer " + token,
"Content-Type": "application/json",
},
});
const text = await response.text()
return text;
}
Submitted by rossmccrann 851 days ago