How to create a custom array of an item repeated N times

I’m currently building an automation where I need an array, that contains arrays that are empty, that needs to repeat N times. I’ll clarify it with an example:

variable repetitions = 3
variable array_content = [" "]

expected output: [ [" “] , [” “] , [” "] ]

I need these for spreadsheets.batchUpdate, to update n number of cells in a same column. So, in values I have to pass an array of arrays with the desired content of the cells, but the number of cells are not consistent.

Any help is welcomed

Welcome to the Make community!

Yes that certainly can be done, but did you know Google Sheets now already has a batch create and batch update rows module?

Yeah I’ve seen the Bulk Update Cells module, but somehow it was not as effective as doing an API Call. So, would you know how I can structure that array out of a number and the array [“”]?

Welcome to the Make community!

In that case, this is possible with a minimum of two modules:

Output

Screenshot_2024-08-02_080809

Hope this helps! Let me know if there are any further questions or issues.

You can also join us in the Make Fans Discord server to chat with other makers. Due to the evolving needs of this community, the Discord invite link can be found elsewhere on this forum. You can either search for it or message me to request an invite.

2 Likes

Perfect SamLiew, Thank you for your help!

1 Like

No problem, glad I could help!

1. If anyone has a new question in the future, please start a new thread. This makes it easier for others with the same problem to search for the answers to specific questions, and you are more likely to receive help since newer questions are monitored closely.

2. The Make Community guidelines encourages users to try to mark helpful replies as solutions to help keep the Community organized.

This marks the topic as solved, so that:

  • others can save time when catching up with the latest activity here, and
  • allows others to quickly jump to the solution if they come across the same problem

To do this, simply click the checkbox at the bottom of the post that answers your question:
Screenshot_2023-10-04_161049

3. Don’t forget to like and bookmark this topic so you can get back to it easily in future!

Here are some useful links and guides you can use to learn more on how to use the Make platform, apps, and app modules. I found these useful when I was learning Make, and hope they might benefit you too —

Getting Started

Help Centre Basics

Articles & Videos

Partner & Custom Apps

Hope this helps!