Hi!
The code I used is the same from above:
function result(range) { //range is a list of rows row_delimiter = “##” col_delimiter = “::” col_split_index = 1 //this is the column to do the split on //get number of columns in the split //var split1 = range[0][col_split_index].split(row_delimiter); //var num_col_split = split1.split(col_delimiter).length; var output = ; //loop over the rows for(var r=0, rLen=range.length; r<rLen; r++) { //loop over the column to be split to get the new number of rows var split_rows = range[r][col_split_index].split(row_delimiter); //get the column to split on for(var sr = 0, srLen=split_rows.length; sr<srLen; sr++) { var new_row = ; //loop over each column for(var c=0, cLen=range[0].length; c<cLen; c++) { if(c != col_split_index) { //if it’s the column that was split, just save that split text to the column new_row.push(range[r][c]); //get the field for this row/column } else { //loop over the columns in the split var split_cols = split_rows[sr].split(col_delimiter); for(var sc=0, scLen=split_cols.length; sc<scLen; sc++) { new_row.push(split_cols[sc]); } } } output.push(new_row); //add this row to the list } } return output } /* range looks like: [r1[col1, col2, col3a::val3a##col3b::val3b, col4], r2[col21, col22, col23a::val23a##col23b::val23b, col24]] which should be transformed to look like: col1, col2, col3a, val3a, col4 col1, col2, col3a, val3b, col4 col21, col22, col23a, val23a, col24 col21, col22, col23a, val23b, col24 */
I still run into loading errors occasionally. It appears to be triggered when data is added to the spreadsheet from Shopify Flow.