Managing Sheet with APIs

SheetAPI.getCell



getCell( hd, sheetTabId, rowIndex, colIndex )

SheetAPI.getCell method is used to get cell json data of input specific sheetId, row and column.

Parameters The handle information of the Sheet application your created. The specific sheet tab id. If it is not provided or undefined, the default value will be currently active sheet tab id. rowIndex is the row number. colIndex is the column number.

Returns

The json data object includes this cell information.

{
	"incell":false,
	"data":"$3.00",
	"cal":true,
	"arg":"sum(1,2)",
	"value":3,
	"timestamp":"20141228153627729",
	"fw":"bold",
	"u":"underline",
	"fs":"italic",
	"s":"line-through",
	"bgc":"#F79646",
	"color":"#9BBB59",
	"fm":"money|$|2|none",
	"blw":0,
	"pl":2,
	"blc":"black",
	"bls":"",
	"blt":false,
	"blf":2,
	"brc":"black",
	"brs":"",
	"brw":2,
	"brt":false,
	"pr":1,
	"btw":0,
	"pt":2,
	"btc":"black",
	"bts":"",
	"btt":false,
	"btf":2,
	"bbc":"black",
	"bbs":"",
	"bbw":2,
	"bbt":false,
	"pb":1,
	"va":"top",
	"height":15,
	"wrap":false,
	"body":true,
	"cdt":"",
	"width":75,
	"ff":"",
	"fz":10,
	"ws":"nowrap",
	"ww":"normal",
	"ta":"right",
	"ti":0,
	"o":"",
	"brf":"",
	"bbf":"",
	"wpr":5,
	"wpb":5,
	"it":"",
	"itn":""
}

To see detail definition for the cell properties, please go to page: Cell Properties Definition

Example code


var cellData = SHEET_API.getCell(SHEET_API_HD, sheetId, rowIndex, colIndex);

// chck whether it is formula
if (cellData.cal) {
    var formula = cellData.arg;
    var value = cellData.value;
    var result = cellData.data;
    var format = cellData.fm;
    var detailFormat = cellData.dfm;
} else {
    var result = cellData.data;
    var format = cellData.fm;
    var detailFormat = cellData.dfm;
}
    

The above code will get the json data from the specific cell. You can check detail data in this cell from return json object.

 

 


Copyright © FeyaSoft Inc. All rights reserved.