Edits history of script submission #184 for ' Clear Cell (gsheets)'

  • deno
    import * as wmill from "https://deno.land/x/[email protected]/mod.ts";
    
    /** @param range 'A1' notation or 'R1C1' notation (https://developers.google.com/sheets/api/guides/concepts#cell) */
    export async function main(gsheets_auth: wmill.Resource<"gsheets">,
        spreadsheetId: string,
        range: string
    ) {
    
      const token = gsheets_auth["token"];
    
      const CLEAR_CELLS_URL =
        `https://sheets.googleapis.com/v4/spreadsheets/${spreadsheetId}/values/${range}:clear`;
    
      const response = await fetch(CLEAR_CELLS_URL, {
        method: "POST",
        headers: {
          Authorization: "Bearer " + token,
          "Content-Type": "application/json",
        },
      });
    
      const json = await response.json()
      if(json.error) {
        const { code, status, message} = json.error
        throw Error(`\n${code} ${status} - "${message}"`)
      }
      return `Cells cleared in the range of '${json.clearedRange}'`;
    }

    Submitted by adam-kov 1301 days ago

  • deno
    import * as wmill from "https://deno.land/x/[email protected]/mod.ts";
    
    /** @param range 'A1' notation or 'R1C1' notation (https://developers.google.com/sheets/api/guides/concepts#cell) */
    export async function main(gsheets_auth: wmill.Resource<"gsheets">,
        sheetId: string,
        range: string
    ) {
    
      const token = gsheets_auth["token"];
    
      const CLEAR_CELLS_URL =
        `https://sheets.googleapis.com/v4/spreadsheets/${sheetId}/values/${range}:clear`;
    
      const response = await fetch(CLEAR_CELLS_URL, {
        method: "POST",
        headers: {
          Authorization: "Bearer " + token,
          "Content-Type": "application/json",
        },
      });
    
      const json = await response.json()
      if(json.error) {
        const { code, status, message} = json.error
        throw Error(`\n${code} ${status} - "${message}"`)
      }
      return `Cells cleared in the range of '${json.clearedRange}'`;
    }

    Submitted by adam-kov 1301 days ago

  • deno
    import * as wmill from "https://deno.land/x/[email protected]/mod.ts";
    
    /** @param range 'A1' notation or 'R1C1' notation (https://developers.google.com/sheets/api/guides/concepts#cell) */
    export async function main(gsheets_auth: wmill.Resource<"gsheets">,
        sheetId: string,
        range: string
    ) {
    
      const token = gsheets_auth["token"];
    
      const CLEAR_CELLS_URL =
        `https://sheets.googleapis.com/v4/spreadsheets/${sheetId}/values/${range}:clear`;
    
      const response = await fetch(CLEAR_CELLS_URL, {
        method: "POST",
        headers: {
          Authorization: "Bearer " + token,
          "Content-Type": "application/json",
        },
      });
      const json = await response.json()
    
      return `Cells cleared in the range of '${json.clearedRange}'`;
    }

    Submitted by adam-kov 1301 days ago

  • deno
    import * as wmill from "https://deno.land/x/[email protected]/mod.ts";
    
    export async function main(gsheets_auth: wmill.Resource<"gsheets">,
        spreadsheetId: string,
        sheetId: number,
        // 'A1' notation or 'R1C1' notation (https://developers.google.com/sheets/api/guides/concepts#cell)
        range: string
    ) {
    
        const token = gsheets_auth["token"];
    
        const CLEAR_CELLS_URL =
            `https://sheets.googleapis.com/v4/spreadsheets/${spreadsheetId}/values/${range}:clear`;
    
        const response = await fetch(DELETE_ROWS_URL, {
            method: "POST",
            headers: {
                Authorization: "Bearer " + token,
                "Content-Type": "application/json",
            },
        });
        const json = await response.json()
    
        return `Cells cleared in the range of '${json.clearedRange}'`;
    }

    Submitted by adam-kov 1304 days ago