gsheets.googlesheets.clearvalues
Home > @runlightyear/gsheets > GoogleSheets > clearValues
GoogleSheets.clearValues() method
This API is in beta and may contain contain bugs. Can be used in production with caution.
Clear values from a spreadsheet.
Signature:clearValues(props: ClearValuesProps): Promise<ClearValuesResponse>;
Parameters
Parameter | Type | Description |
---|---|---|
props | ClearValuesProps |
Promise<ClearValuesResponse>
Example 1
Clear a row
import { defineAction } from "@runlightyear/lightyear";
import { GoogleSheets } from "@runlightyear/gsheets";
defineAction({
name: "clearRow",
title: "Clear Row",
apps: ["gsheets"],
variables: ["spreadsheetId"],
run: async ({ auths, variables }) => {
const gsheets = new GoogleSheets({
auth: auths.gsheets,
});
const response = await gsheets.clearValues({
spreadsheetId: variables.spreadsheetId!,
range: "1:1",
});
console.log("Response: ", response.data);
},
});
Example 2
Clear a column
import { defineAction } from "@runlightyear/lightyear";
import { GoogleSheets } from "@runlightyear/gsheets";
defineAction({
name: "clearColumn",
title: "Clear Column",
apps: ["gsheets"],
variables: ["spreadsheetId"],
run: async ({ auths, variables }) => {
const gsheets = new GoogleSheets({
auth: auths.gsheets,
});
const response = await gsheets.clearValues({
spreadsheetId: variables.spreadsheetId!,
range: "A:A",
});
console.log("Response: ", response.data);
},
});