NO IMAGE

Google Apps Scriptでスプレッドシートの内容を配列で取得する

[javascript] // シート情報を配列に変換して取得
function getSheet2Ary(SheetUrl, SheetName){
var spreadsheet = SpreadsheetApp.openByUrl(SheetUrl);
var sheets = spreadsheet.getSheets();
for (var sheet in sheets)
{
if (sheets[sheet].getSheetName() == SheetName)
{
var sheet = sheets[sheet];

var startrow = 1;
var startcol = 1;
var lastrow = sheet.getLastRow();
var lastcol = sheet.getLastColumn();

var sheetdata = sheet.getSheetValues(startrow, startcol, lastrow, lastcol);

return sheetdata;
}
}
}
[/javascript]