Home > Enterprise >  How to *reverse* comma separated output that combines data from 2 specific cells?
How to *reverse* comma separated output that combines data from 2 specific cells?

Time:06-02

I wrote code (based on How to collect data from multiple cells (quantity of 2) and return an output with 2 comma-separated values in one cell? AppScripts) that returns an output of comma separated values. It works great.

For example,

Input:

A1 = 1

B1 = 2

Results in Output: 1, 2

Here is that code:

[formSheet.getRange("E25").setValue(row[2])   ", "   
formSheet.getRange("F25").setValue(row[2])],

The context is a spreadsheet-based Form. (No, the generic Google Forms does not work for our purposes).

Now I got myself in a pickle because users are requesting the Feature of being able to Retrieve and Edit their Form.

Ok. I can do that.

Until....

I get to those Output cells that are comma separated. Whoops. Is there a way to reverse this process, so that each value goes back into its respective Input cell?

Output (source): 1, 2

Retrieved Results:

A1 = 1

B1 = 2

Thanks!

CodePudding user response:

Just split and setValues:

formSheet.getRange('E25:F25').setValues([
  outputSheet.getRange('A25').getValue().split(', ')
])
  • Related