0

I'm working on a project that outputs a huge array, and I need to clean it up to send in an email. It seems the simplest approach is the split() function, but I can't seem to make it work.

function splitArray() {
var ss = SpreadsheetApp.getActiveSheet();
var row = ss.getLastRow();
var range = ss.getRange(row, 1, 1, ss.getMaxColumns());
var data = range.getValues();
data.split("\n");
Logger.log(data);}
asked Sep 18, 2013 at 15:42
0

1 Answer 1

2

You need to set the return value of data.split("\n"); to something. You are splitting the value successfully but not storing that value anywhwere

Try:

data = data.split("\n");

or

Logger.log(data.split("\n"));
answered Sep 18, 2013 at 15:43
Sign up to request clarification or add additional context in comments.

2 Comments

This looks great, except that Google returns this: "TypeError: Cannot find function split in object". I'm not sure Google Apps Script recognizes the split function.
Seems like data is already an array. Try logging data before doing the split

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.