Skip to content
This repository has been archived by the owner on Oct 6, 2022. It is now read-only.

Latest commit

 

History

History
70 lines (61 loc) · 1.89 KB

excel.getArray.md

File metadata and controls

70 lines (61 loc) · 1.89 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 true;
			}else{
				return false;
			}
		}
	, {
		"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;}
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, <a href="formatter&rounder.md">formatter</a>, <a href="formatter&rounder.md">rounder</a>], 
		data3:function(row){ return String|Number|Date|Boolean;} 
	},
	{...}
]