The Make Array column allows you to join multiple values from various columns into an array, regardless of their column names.
About array columns
If you’re familiar with arrays in Glide, you’ll know that Glide will automatically create an array if the columns in your Google Sheet are named sequentially. This is useful for columns with similar data, like multiple image columns to create an image carousel or to assign multiple Roles or Row Owners in your project.
There may be times when you need to create an array that is based on columns that contain different information or when column names aren’t identical. This is where the capabilities of the Make Array column can provide greater functionality in your project.
How to create Make Array columns
- In the Data Editor, open the table you want to edit.
- Add a new column by clicking the plus symbol to the right of the table.
- Give the new column a name.
- In the Type dropdown, choose Other from the list of computed columns, then select Make Array.
- Under Items, enter a custom value, or select a column from your data source to use as the first item of your array.
- Continue to add items to build out your array as needed. You can select columns of different types for your array. Once you’ve entered all the items, click Done.
Ways you can use the Make Array column
Combine images from different columns to create an image carousel
If your data source has multiple image columns, you can use the Make Array column to combine them into a single array column that can be used to display an image carousel in your app. This is especially useful if you’re using a data source other than Google Sheets or if your image columns are not named similarly and sequentially.
Combine multiple arrays to form a new array
Your data source may contain multiple arrays. For example, you may have an array of exterior photos of a property and an array of interior photos of a property. Using the Make Array column, you can combine these arrays to create an image carousel that displays all the photos for each property.
Add an item to an array
If you need to include an additional column value as part of an existing array, you can add it as an item in your array. Although you cannot rearrange existing items in a Make Array column, you can add a new item before the first array to display it at the start or after the last to show it at the end.
Create a list of items that ignores empty columns
The Make Array column only includes non-empty data from the columns you assign as items in your array. Because of this, you can create a nicely formatted comma-separated list that automatically ignores any cells without a value.
You can also combine columns of data using a Template column. However, the Template column does not ignore empty data like the Make Array column. Any cells without a value may be pulled into a comma-separated list as punctuation or gaps.
To set up a comma-separated list:
- Add a Make Array column.
- Select the columns from your data source that you’d like to include in the array.
- Add a Joined List column and select your Make Array column as the source.
Perform various math functions
Suppose your data source contains multiple columns of numbered values. In that case, you can use the Make Array column to group the data and then perform a variety of math functions. This is especially useful if some of your columns are empty.
Example: You may have a data source that contains scores for various tests. Some tests may be completed while some are not yet completed. A Math column that calculates the average scores of all tests would not be accurate for each row, as it would assume zero values for each of the empty cells. Use the Make Array column to exclude empty columns from your calculation, then use a Rollup column to calculate the average.