I wasn't planning on posting this as it's very simple but someone requested it, and it can be very useful

.
This simple script will load a Google Docs spreadsheet and turn it into an array of rows/columns.
PHP Code:
public function parseSpreadsheet(url) {
temp.req = requestURL(url);
waitfor(req, "onReceiveData", 30);
temp.rows = null;
temp.lines = req.data;
for (temp.line : lines) {
temp.row = null;
for (temp.column : line.tokenize(char(9))) {
row.add(column);
}
rows.add(row);
}
return rows;
}
To get the URL needed, from the Google Spreadsheet choose "Share" then "Publish as web page" at the top-right. Click "Start publishing" and optionally click "Automatically republish as I make changes". Then, from the drop-down list for "Get the link to share", choose "TXT (Plain text)" and copy the link given.
Example usage:
PHP Code:
function onCreated() {
temp.url = "my_url";
temp.rows = parseSpreadsheet(url);
for (temp.row : rows) {
echo(row);
}
}
I'm sure you can think up plenty of uses for this. The one I'm currently using it for on Era is a translation table—the spreadsheet is cached into a script-friendly file which is sent to players on login and can be used for translating text.
