/** Update values(s) in the given range.
*
* @param startCell Use 'A1' notation.
* https://developers.google.com/sheets/api/guides/concepts#cell
*
* @param responseValueRenderOption Determines how values in the response should be rendered.
* https://developers.google.com/sheets/api/reference/rest/v4/ValueRenderOption
*
* @param responseDateTimeRenderOption Determines how dates, times, and durations in the response should be rendered.
* This is ignored if `responseValueRenderOption` is `FORMATTED_VALUE`.
* https://developers.google.com/sheets/api/reference/rest/v4/DateTimeRenderOption
*/
type Gsheets = {
token: string;
};
export async function main(
gsheets_auth: Gsheets,
spreadsheetId: string,
startCell: string,
values: Array<Array<any>>,
majorDimension: "ROWS" | "COLUMNS" = "ROWS",
valueInputOption: "RAW" | "USER_ENTERED" = "USER_ENTERED",
responseValueRenderOption:
| "FORMATTED_VALUE"
| "UNFORMATTED_VALUE"
| "FORMULA" = "FORMATTED_VALUE",
responseDateTimeRenderOption:
| "SERIAL_NUMBER"
| "FORMATTED_STRING" = "SERIAL_NUMBER",
) {
const token = gsheets_auth["token"];
let UPDATE_VALUES_URL = `https://sheets.googleapis.com/v4/spreadsheets/${spreadsheetId}/values/${startCell}?includeValuesInResponse=true`;
UPDATE_VALUES_URL += `&valueInputOption=${valueInputOption}`;
UPDATE_VALUES_URL += `&responseValueRenderOption=${responseValueRenderOption}`;
UPDATE_VALUES_URL += `&responseDateTimeRenderOption=${responseDateTimeRenderOption}`;
const body = {
values,
majorDimension,
};
const response = await fetch(UPDATE_VALUES_URL, {
method: "PUT",
body: JSON.stringify(body),
headers: {
Authorization: "Bearer " + token,
"Content-Type": "application/json",
},
});
const json = await response.json();
if (json.error) {
let { code, status, message } = json.error;
throw Error(`\n${code} ${status} - "${message}"\n`);
}
return json;
}
Submitted by admin 497 days ago
/** Update values(s) in the given range.
*
* @param startCell Use 'A1' notation.
* https://developers.google.com/sheets/api/guides/concepts#cell
*
* @param responseValueRenderOption Determines how values in the response should be rendered.
* https://developers.google.com/sheets/api/reference/rest/v4/ValueRenderOption
*
* @param responseDateTimeRenderOption Determines how dates, times, and durations in the response should be rendered.
* This is ignored if `responseValueRenderOption` is `FORMATTED_VALUE`.
* https://developers.google.com/sheets/api/reference/rest/v4/DateTimeRenderOption
*/
type Gsheets = {
token: string;
};
export async function main(
gsheets_auth: Gsheets,
spreadsheetId: string,
startCell: string,
values: Array<Array<any>>,
majorDimension: "ROWS" | "COLUMNS" = "ROWS",
valueInputOption: "RAW" | "USER_ENTERED" = "USER_ENTERED",
responseValueRenderOption:
| "FORMATTED_VALUE"
| "UNFORMATTED_VALUE"
| "FORMULA" = "FORMATTED_VALUE",
responseDateTimeRenderOption: "SERIAL_NUMBER" | "FORMATTED_STRING" =
"SERIAL_NUMBER",
) {
const token = gsheets_auth["token"];
let UPDATE_VALUES_URL =
`https://sheets.googleapis.com/v4/spreadsheets/${spreadsheetId}/values/${startCell}?includeValuesInResponse=true`;
UPDATE_VALUES_URL += `&valueInputOption=${valueInputOption}`;
UPDATE_VALUES_URL +=
`&responseValueRenderOption=${responseValueRenderOption}`;
UPDATE_VALUES_URL +=
`&responseDateTimeRenderOption=${responseDateTimeRenderOption}`;
const body = {
values,
majorDimension,
};
const response = await fetch(UPDATE_VALUES_URL, {
method: "PUT",
body: JSON.stringify(body),
headers: {
Authorization: "Bearer " + token,
"Content-Type": "application/json",
},
});
const json = await response.json();
if (json.error) {
let { code, status, message } = json.error;
throw Error(`\n${code} ${status} - "${message}"\n`);
}
return json;
}
Submitted by admin 500 days ago
import * as wmill from "https://deno.land/x/windmill@v1.85.0/mod.ts";
/** Update values(s) in the given range.
*
* @param startCell Use 'A1' notation.
* https://developers.google.com/sheets/api/guides/concepts#cell
*
* @param responseValueRenderOption Determines how values in the response should be rendered.
* https://developers.google.com/sheets/api/reference/rest/v4/ValueRenderOption
*
* @param responseDateTimeRenderOption Determines how dates, times, and durations in the response should be rendered.
* This is ignored if `responseValueRenderOption` is `FORMATTED_VALUE`.
* https://developers.google.com/sheets/api/reference/rest/v4/DateTimeRenderOption
*/
export async function main(
gsheets_auth: wmill.Resource<"gsheets">,
spreadsheetId: string,
startCell: string,
values: Array<Array<any>>,
majorDimension: "ROWS" | "COLUMNS" = "ROWS",
valueInputOption: "RAW" | "USER_ENTERED" = "USER_ENTERED",
responseValueRenderOption:
| "FORMATTED_VALUE"
| "UNFORMATTED_VALUE"
| "FORMULA" = "FORMATTED_VALUE",
responseDateTimeRenderOption: "SERIAL_NUMBER" | "FORMATTED_STRING" =
"SERIAL_NUMBER",
) {
const token = gsheets_auth["token"];
let UPDATE_VALUES_URL =
`https://sheets.googleapis.com/v4/spreadsheets/${spreadsheetId}/values/${startCell}?includeValuesInResponse=true`;
UPDATE_VALUES_URL += `&valueInputOption=${valueInputOption}`;
UPDATE_VALUES_URL +=
`&responseValueRenderOption=${responseValueRenderOption}`;
UPDATE_VALUES_URL +=
`&responseDateTimeRenderOption=${responseDateTimeRenderOption}`;
const body = {
values,
majorDimension,
};
const response = await fetch(UPDATE_VALUES_URL, {
method: "PUT",
body: JSON.stringify(body),
headers: {
Authorization: "Bearer " + token,
"Content-Type": "application/json",
},
});
const json = await response.json();
if (json.error) {
let { code, status, message } = json.error;
throw Error(`\n${code} ${status} - "${message}"\n`);
}
return json;
}
Submitted by adam186 628 days ago
import * as wmill from "https://deno.land/x/windmill@v1.70.1/mod.ts";
/** Update values(s) in the given range.
*
* @param startCell Use 'A1' notation.
* https://developers.google.com/sheets/api/guides/concepts#cell
*
* @param responseValueRenderOption Determines how values in the response should be rendered.
* https://developers.google.com/sheets/api/reference/rest/v4/ValueRenderOption
*
* @param responseDateTimeRenderOption Determines how dates, times, and durations in the response should be rendered.
* This is ignored if `responseValueRenderOption` is `FORMATTED_VALUE`.
* https://developers.google.com/sheets/api/reference/rest/v4/DateTimeRenderOption
*/
export async function main(
gsheets_auth: wmill.Resource<"gsheets">,
spreadsheetId: string,
startCell: string,
values: Array<Array<any>>,
majorDimension: "ROWS" | "COLUMNS" = "ROWS",
valueInputOption: "RAW" | "USER_ENTERED" = "USER_ENTERED",
responseValueRenderOption:
| "FORMATTED_VALUE"
| "UNFORMATTED_VALUE"
| "FORMULA" = "FORMATTED_VALUE",
responseDateTimeRenderOption: "SERIAL_NUMBER" | "FORMATTED_STRING" =
"SERIAL_NUMBER",
) {
const token = gsheets_auth["token"];
let UPDATE_VALUES_URL =
`https://sheets.googleapis.com/v4/spreadsheets/${spreadsheetId}/values/${startCell}?includeValuesInResponse=true`;
UPDATE_VALUES_URL += `&valueInputOption=${valueInputOption}`;
UPDATE_VALUES_URL +=
`&responseValueRenderOption=${responseValueRenderOption}`;
UPDATE_VALUES_URL +=
`&responseDateTimeRenderOption=${responseDateTimeRenderOption}`;
const body = {
values,
majorDimension,
};
const response = await fetch(UPDATE_VALUES_URL, {
method: "PUT",
body: JSON.stringify(body),
headers: {
Authorization: "Bearer " + token,
"Content-Type": "application/json",
},
});
const json = await response.json();
if (json.error) {
let { code, status, message } = json.error;
throw Error(`\n${code} ${status} - "${message}"\n`);
}
return json;
}
Submitted by adam186 663 days ago
import * as wmill from "https://deno.land/x/windmill@v1.46.2/mod.ts";
/** Update values(s) in the given range.
*
* @param startCell Use 'A1' notation.
* https://developers.google.com/sheets/api/guides/concepts#cell
*
* @param responseValueRenderOption Determines how values in the response should be rendered.
* https://developers.google.com/sheets/api/reference/rest/v4/ValueRenderOption
*
* @param responseDateTimeRenderOption Determines how dates, times, and durations in the response should be rendered.
* This is ignored if `responseValueRenderOption` is `FORMATTED_VALUE`.
* https://developers.google.com/sheets/api/reference/rest/v4/DateTimeRenderOption
*/
export async function main(
gsheets_auth: wmill.Resource<"gsheets">,
spreadsheetId: string,
startCell: string,
values: Array<Array<any>>,
majorDimension: "ROWS" | "COLUMNS" = "ROWS",
valueInputOption: "RAW" | "USER_ENTERED" = "USER_ENTERED",
responseValueRenderOption:
| "FORMATTED_VALUE"
| "UNFORMATTED_VALUE"
| "FORMULA" = "FORMATTED_VALUE",
responseDateTimeRenderOption: "SERIAL_NUMBER" | "FORMATTED_STRING" =
"SERIAL_NUMBER",
) {
const token = gsheets_auth["token"];
let UPDATE_VALUES_URL =
`https://sheets.googleapis.com/v4/spreadsheets/${spreadsheetId}/values/${startCell}?includeValuesInResponse=true`;
UPDATE_VALUES_URL += `&valueInputOption=${valueInputOption}`;
UPDATE_VALUES_URL +=
`&responseValueRenderOption=${responseValueRenderOption}`;
UPDATE_VALUES_URL +=
`&responseDateTimeRenderOption=${responseDateTimeRenderOption}`;
const body = {
values,
majorDimension,
};
const response = await fetch(UPDATE_VALUES_URL, {
method: "PUT",
body: JSON.stringify(body),
headers: {
Authorization: "Bearer " + token,
"Content-Type": "application/json",
},
});
const json = await response.json();
if (json.error) {
let { code, status, message } = json.error;
throw Error(`\n${code} ${status} - "${message}"\n`);
}
return json;
}
Submitted by adam-kov 768 days ago