'Splitting out product details in cell

I have a sheet full of product details that have been scraped from a website. All the dimensions are grouped in one cell by product. The same goes for product details. Some contain more dimension and product details than others.

enter image description here

Is there a way to split all these out into unique columns?

Thanks!



Solution 1:[1]

Any cell that contains multiple lines of text can be split into an array of text. For example G112 contains 7 lines.

function test() {
  try {
    var sh = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sheet1");
    var value = sh.getRange("G112").getValue();
    console.log(value.split('\n'));
  }
  catch(err) {
    console.log(err);
  }
}

Would produce an array ['Size Small','Item Width 1,400mm',...]?

Since each cell has a different number of lines you'll have to pack some rows to make a symmetrical 2 dimensional array and then put if back somewhere.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 TheWizEd