Skip to content

Latest commit

 

History

History
77 lines (63 loc) · 1.74 KB

excel.getArray.md

File metadata and controls

77 lines (63 loc) · 1.74 KB

Excel.getArray

The getArray function is established to get several fields as an array from one sheet.

Sample

var excel = new Excel("test.xlsx");
var ary1 = excel.getArray("Sheet1", 1, 3, 
	{
		"data1":"A", 
		"data2":"B", 
		"data3":"C"
	});
var ary2 = excel.getArray("Sheet1", 1, 
	function(row){
		if (excel.getValue("Sheet1","A"+row)!=""){
			return false;
		}else{
			return true;
		}
	}
, {
	"data1":"A", 
	"data2":["B","#,##0.0","HALF_EVEN"], 
	"data3":["C","yyyy/MM/dd"], 
	"data4":
		function(row){
			return excel.getValue("Sheet1","D"+row)+excel.getValue("Sheet1","E"+row);
		}
});
var ary3 = excel.getArray{"Sheet1", 1, 4,[{"data1":"A"},{"data2":"A"}]};

API

CallingReturning
Excel . getArray ( sheetName , startRow , endCondition , positionRowMaps )Array
ParametersTypeDescription
sheetNameStringThe sheet name.
startRowNumberThe start row for looping at the sheet. Indexed from 1.
endConditionNumber | FunctionThe end condition for looping at the sheet. It is a number or a function. Indexed from 1.
function ( row ) {return true;}</pre>
positionRowMapsObject | Array Object: The map for getting data from a row.
Array: The maps for getting data from several rows.
{	data1:col, 
	data2:[col, formatter, rounder], 
	data3:function(row){ return String|Number|Date|Boolean;} 
}

[
	{	data1:col, 
		data2:[col, formatter, rounder], 
		data3:function(row){ return String|Number|Date|Boolean;} 
	},
	{...}
]