How to transfer two arrays from a collection to a Google Sheet, with each array filling a separate column

It’s probably something simple but I just can’t seem to figure out how to map the values from each array into separate columns in a Google Sheet.

My spreadsheet has two columns, one for the workout name and another for the description.

I can successfully iterate through a single array but haven’t had any luck mapping both arrays at the same time and just not sure how to configure this work flow.

Hello,

will the arrays always contain 5 items each? You can use the orderindex to map specific items to specific cells.

2 Likes

The total number of items in each array will vary but they will always be 1:1.

For instance, there may only be 3 workouts and 3 descriptions, or 4 workouts and 4 descriptions, etc.

OK so when you are iterating the first array you should get a bundle order position number from the Iterator module. You can use that to get the same order item from the second array and map it directly.

3 Likes

Hey Stoyan, thanks for pointing me in the right direction. With some additional guidance from ChatGPT, I was able to figure it out.

==============================================

Given the structure of your arrays, where both wodName and description are contained within a single object, you can use the following approach to map these arrays to a Google Sheet with Make.com:

  1. Array Aggregation:
  • Since your arrays are structured as properties of a single object, you do not need to create a compound array. The wodName and description are already paired based on their index within each array.
  1. Add an Iterator Module:
  • Place an Iterator module in your scenario.
  • Configure the Iterator to iterate over one of the arrays, for example, wodName. The Iterator will process each element of this array sequentially.
  1. Mapping Iterator Output to Google Sheets:
  • Add a Google Sheets module (e.g., ‘Add a Row’) after the Iterator.
  • In the Google Sheets module, map the current item from the wodName array to the first column. This can typically be done using a reference like Iterator.wodName.
  1. Using the Iterator’s Index for the Second Array:
  • For the second column in Google Sheets, you need to map the corresponding description.
  • Since both arrays are of the same length and properly aligned, use the Iterator’s index to reference the corresponding description. This would be something like Array.description[Iterator.index], where Array refers to the original data structure containing both arrays.
  1. Test the Configuration:
  • Run the scenario to ensure that the Iterator is processing each wodName and its corresponding description correctly.
  • Verify in the Google Sheet that each wodName is paired with the correct description.
  1. Debugging:
  • If the data doesn’t align as expected, check the lengths of both arrays to ensure they match.
  • Verify that the references used in the Google Sheets module correctly correspond to the structure of your data.

This setup will allow each wodName from the wodName array to be mapped to a row in Google Sheets, along with the corresponding description from the description array based on their index positions.

1 Like

Hello @seldomstatic welcome to the community :blob_wave:

Awesome that you managed to figure this one out with a little help from @Stoyan_Vatov and good old ChatGPT. :clap:

Also, thanks very much for stepping back in here and sharing what you learned with the rest of the community. This can be super helpful to many others who are looking for similar information in the future :pray:

1 Like