Leverage Google Apps Scripting to extend the UI
Update: This script can now be installed viais available in the 'Script Gallery'. That means you can easily install it into your spreadsheet without dealing with any codeScript Gallery. Just install the script namedsearch for 'Text to Columns' from the gallery, reloadinstall the spreadsheetscript, and wait a few seconds forrefresh the 'Advanced' toolbar itemspreadsheet. Note: it may be slow to appearload the first time.
It'sText to Columns, is a commonly usedvery handy feature and one of Excelthe reasons that a lot of Google Spreadsheets still lacksSpreadsheet users go back to using Excel. FortunatelyUntil, there are workarounds that will do the same or better.
##Use a function
In cell B2 paste the following:
=ARRAYFORMULA(IFERROR(SPLIT(A1:A;"|")))
Then paste your data starting with cell A2. As soon as you enter the data it will automatically split the combined valuesGoogle decides to a value-per-column usingofficially support the '|'feature, this solution can be used as a delimiter.
Here's creditpolyfill to add in the original author of this approachfunctionality.
Leverage Google Apps Scripting to extend the UI
Go to:
Tools → Script editor...
Paste the following:Here's the code:
To use it:Usage:
- Select the cell(s) containing the values to split
- Select Advanced → Text to columns
It's magicThat's it. It'll automaticallyYou can also do a split the values out into columns. If you were wondering, the non-custom "Textusing a custom delimiter (via 'Text to column" function uses commas as separators.
If you haven't noticed yet, this option comes with an added bonus, there are options in the menu that willColumns (Custom)') and reverse the process.
Best of all, because this works as a function you can roll it into any script. For example, if you want you could get rid of the menu and make a column automatically expand values by triggering the function during an onEdit event.
Note: If you take a good long hard look at the Text to columns code it may seem a little complicated. That's because it has been optimized to cache all of the values, pre-calculate all of the results and load them all at once (vs per-row). Unfortunately, the setValues
function doesn't accept jagged arrays so I had to roll a solution to pad all of the rows to the same length before loading the results.
Update:
The code has been updated to include the ability (via 'Columns to convert multiple cells at onceText').