CSV to array

Hi all,
This may not be something that the imp can do but it seems so simple that I feel like it must. I am primarily a hardware person so forgive my code ignorance.

I am building a panic button for my company, using the imp and twillo.
Basically the button is pushed and a text message is sent to every number in an array.
We want to have this device text everyone who works in the building.

This is all done and tested, but currently the only way for me to modify the list of people who get the message is to open the code and change the array. Is there a way to point the imp at a document, like a csv, that contains the list of numbers and saves that as an array.
Thanks all,

why not send/modify your list by http?

Dolf Thank you for your replay. I am sorry to say I don’t know enough about the agent code to know how to do that. I looked at some of the Dev resources but the answer was no redly apparent. If me doc was at http://xxxx.com/doc.csv could you give me an example of the code I would use to call the document into the array?
Thanks again.

I suppose the best way is to use a JSON formatted array.
Of how many numbers are we talking?

between 50 and 100

Here’s a quick function that takes in a URL (to a CSV file), grabs the file, then processes it into a 2D array:

`function processCSV(url) {
// get the data
local resp = http.get(url).sendsync();

// if there was an error, return null
if (resp.statuscode != 200) return null;

local results = [];

local fileLines = split(resp.body, "\\r\

foreach(line in fileLines) {
results.push(split(line, “,”));

return results;    


local url = “http://mrgibson.com/comics.csv”;
local data = processCSV(url);

server.log(format(“Read %i lines of data”, data.len()));
foreach(i, line in data) {
foreach(cell in line) {
// look at each individual cell

// Arrays are Zero-Indexed, so to get data in cell [22,8]
// we look at data[21][7]:
server.log(format(“Data in Row 11, Col 7: %s”, data[21][7]));`

Thank you very much, I will play with that and see if I can make it work for me.