Google-sheets – How to concatenate cells using ARRAYFORMULA across rows and columns

concatenateformulasgoogle-sheets-arrayformulagoogle-sheets-query

I have a document that's a recurring CSV import/export.
I'm trying to concatenate images separated by ", " and using ARRAYFORMULA to make it all the way down.

The problem is, I don't know how many images there will be, but I know the maximum is 15. So if I concatenate, by for instance using A1+A2...+A15, I will end up with multiple commas at the end since I don't know how many there is.

I have this so far =ARRAYFORMULA(JOIN(", ",FILTER(B3:P3,NOT(B3:P3="")))) in A2.

Can anyone help with how I can concatenate from B2:P2 and wrap it in an ARRAYFORMULA to go all the way down?

link to my spreadsheet

Best Answer

=ARRAYFORMULA(TRANSPOSE(SPLIT(TEXTJOIN("♪", 1, 
 QUERY(TRANSPOSE(IF(B2:Z<>"", B2:Z&",", )), 
 "select *", ROWS(B2:B))), "♪", 0)))