Google Apps Script – Converting column of data into an array

I have a program that works as below

function test() {
var urls = [
    'URL1, 
    'URL2',
    'URL3'
  ]

var results = xx(urls)

^and then xx works its magic and produces results.

Now I want to input the urls via a column in a spreadsheet instead of hard coding them into the script, and so I tried

 function test() {
    var urls = []
    var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Input")
    urls[0] = ss.getRange(2, 1, ss.getLastRow()-1,1).getValues().join()
    
    var results = xx(urls)

But the result is that only one of the URLs gets processed.

73 thoughts on “Google Apps Script – Converting column of data into an array”

Leave a Comment