icecream sugar black
icecream sugar black

Reputation: 63

setvalues() using only one cell in a specific range ex.("A3" in "A3:B4")

This code is entered only when a specific range is entered.

spreadsheet.getRange("A3:B4").setValues([[1,2],[1,33]]);



Desired result
enter image description here

I don't want to specify a specific range ("A3:B4").
I want to specify a range starting at A3 that is expandable depending on the value of a variable. Using one location (A3), I want to input an array of values from that cell.
Is there any way to make this possible?

Upvotes: 1

Views: 103

Answers (1)

TheMaster
TheMaster

Reputation: 50764

You can do this with Advanced Google services/google-sheets-api:

//@see https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/update
Sheets.Spreadsheets.Values.update(
  { values: array }, 
  "SpreadsheetID",
  "Sheet1!A3",
  { valueInputOption: "RAW" }
);

Upvotes: 1

Related Questions