Normally I don’t share our designs, but because this is such a specific case I would like to know if you think this will cover your case correctly. We think it does, so here goes (this one may be a long read
)
Source
Just to be absolutely sure we are talking about the same source, we have used this Google sheets documentation page as input: REST Resource: spreadsheets.values | Google Sheets | Google for Developers.
It speaks about appending data using a list of lists, named values, using the append call documented here: Method: spreadsheets.values.append | Google Sheets | Google for Developers.
Data model
For the design, I have created a very simple data model consisting of a Row data item with the cells as properties:
Note that the properties we will use as cells can be of different types.
This model will allow us to create a list of lists by looking up all rows and then specifying the cells. This is important, because we want each list to have the same length and same types (which is why this design is preferred over a different design where each row item would have a list of cells with a value, for example).
Flow part
As an example, I have created a flow part Append all rows which first looks up all rows, then sends the to the API:
I will omit the lookup for all rows, and instead focus on the connection action. In this case, we want to add the values as an array of arrays (a matrix) to the JSON data by clicking the add button here:
First we need to add the values array to the flow part in the regular way. So the first step remains the same; we select a property from the flow part:
And in this case, we want to send the All rows property of the flow part as an array, so we select this property from the flow part:
This results in our outer values array, meaning each item in this array represents a row:
The next step is adding a value inside of the values array by clicking the add button. This currently shows the following options:
In our proposed solution we would add an option here, List from data item list:
This option is only available if there are no other properties added yet; because we don’t want to combine nameless arrays with named values.
This option would allow you to select multiple values from each Row and represent it as an array:
This would result in the JSON structure as discussed in this thread. Because we only allow either properties, or nameless arrays, no other fields can then be added to the values list.
Conclusion
We think that this solution should cover this specific case, plus allow the flexibility for multiple data types. It also makes sure that the resulting structure is a matrix, and not a list of lists where the inner lists can have different lengths.
Please let us know whether you feel this will indeed cover your case and perhaps other cases you have seen, or that it might be missing things.