0
votes

It seems to me that the google sheets API's append method, the method which is used to add data to google sheet from your program, expects a 2d array. Sam Berlin here seems to say as much Google Sheet API batch update issue iOS. I was wondering if anyone knows why this is?

1

1 Answers

0
votes

If you go the reference page for the method sheets.value.append you will see that the values that you need to introduce is an object of the type ValueRange and from the documentation you can actually see:

values[] The data that was read or to be written. This is an array of arrays, the outer array representing all the data and each inner array representing a major dimension. Each item in the inner array corresponds with one cell.

And why is done that way... well your guess is as good as mine.

Having a standardized object to represent values of a given range (input or output) is a plus when working with any API. Also in cases you want to add more than one row/column at a time you can do it easily by providing a 2-D array, when there would be as arrays as rows/columns you want to insert (as stated by the documentation).

TL;DR: 2-D array are very good analogue of the values inside a range inside a spreadsheet.