Skip to content

Split Cells with Multiple Lines into Columns? #100

Answered by AlexeyMatveev686
iputilin asked this question in Q&A
Discussion options

You must be logged in to vote

I have no idea how to split cells with multiple lines into columns, because there is no feature to use 'Enter' or '\n' or anything common as a separator. Is it somehow possible?

Hello. There is example how you can do it.

(function()
{
    let ws = Api.GetActiveSheet();
    // cell with such data
    let cell = ws.GetRange('A1');
    let value = cell.GetValue();
    let arr = value.split('\n');
    // start paste in columns
    let colRange = ws.GetRange('C1:E1');
    colRange.SetValue(arr);
    // end paste in columns
    // start paste in rows
    let rowRange = ws.GetRange('B1:B3');
    let index = 0;
    rowRange.ForEach( (res) => {
        if (index >= arr.length)
            index …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by trofim24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Issues that look for answers
2 participants