I have setup a google sheet with a script attached to it that runs a function to pull chromebook device information, works great apart from two fields im interested in, "cpuStatusReports" and "diskVolumeReports" the script logger does show the correct info but my sheet cell values is set to for example
{cpuUtilizationPercentageInfo=[Ljava.lang.Object;@d151552, cpuTemperatureInfo=[Ljava.lang.Object;@f57094c, reportTime=2019-03-29T18:15:56.049Z}
my function is :-
function chromebookdetails2() { var domain, chromebooks, page, ss, sheet, pageToken, i var sheetData4 = onSheet.getSheetByName("chromebook") //sheetData4.clear(); domain = "mydomainnamehere" chromebooks= new Array() do{ page = AdminDirectory.Chromeosdevices.list("my_customer", {domain: domain, maxResults: 1000, pageToken: pageToken }) for (i in page.chromeosdevices){ chromebooks.push(page.chromeosdevices[i]) } pageToken = page.nextPageToken }while(pageToken){ var row = 3 //starting row position for (var i = 0; i < chromebooks.length; i++) { var sheetData4 = onSheet.getSheetByName("chromebook") /////////////////////Header//////////////////////////////////////// var date = Utilities.formatDate(new Date(), "GMT+1", "dd/MM/yyyy") sheetData4.getRange(1,1).setValue("Date Ran - "+date); //(2,1 means 2nd row, 1st column) sheetData4.getRange(2,1).setValue("orgUnitPath"); //(2,1 means 2nd row, 1st column) sheetData4.getRange(2,2).setValue("annotatedUser"); sheetData4.getRange(2,3).setValue("annotatedLocation"); sheetData4.getRange(2,4).setValue("annotatedAssetId"); sheetData4.getRange(2,5).setValue("serialNumber"); sheetData4.getRange(2,6).setValue("lastEnrollmentTime"); sheetData4.getRange(2,7).setValue("deviceId"); sheetData4.getRange(2,8).setValue("bootMode"); sheetData4.getRange(2,9).setValue("recentUsers"); sheetData4.getRange(2,10).setValue("macAddress"); sheetData4.getRange(2,11).setValue("lastSync"); sheetData4.getRange(2,12).setValue("osVersion"); sheetData4.getRange(2,13).setValue("platformVersion"); sheetData4.getRange(2,14).setValue("activeTimeRanges"); sheetData4.getRange(2,15).setValue("model"); sheetData4.getRange(2,16).setValue("etag"); sheetData4.getRange(2,17).setValue("firmwareVersion"); sheetData4.getRange(2,18).setValue("status"); sheetData4.getRange(2,19).setValue("ethernetMacAddress"); sheetData4.getRange(2,20).setValue("notes"); sheetData4.getRange(2,21).setValue("systemRamTotal"); sheetData4.getRange(2,22).setValue("CPU");
if(chromebooks[i].length == 0){ // array is empty Logger.log('empty'); } else { //array not empty >Logger.log('not empty');
Logger.log(chromebooks[i].cpuStatusReports);
/////////////////////Array Data///////////////////////////////////
sheetData4.getRange(row,1).setValue(chromebooks[i].orgUnitPath); sheetData4.getRange(row,2).setValue(chromebooks[i].annotatedUser); sheetData4.getRange(row,3).setValue(chromebooks[i].annotatedLocation); sheetData4.getRange(row,4).setValue(chromebooks[i].annotatedAssetId); sheetData4.getRange(row,5).setValue(chromebooks[i].serialNumber); sheetData4.getRange(row,6).setValue(chromebooks[i].lastEnrollmentTime); sheetData4.getRange(row,7).setValue(chromebooks[i].deviceId); sheetData4.getRange(row,8).setValue(chromebooks[i].bootMode); sheetData4.getRange(row,9).setValue(chromebooks[i].recentUsers); sheetData4.getRange(row,10).setValue(chromebooks[i].macAddress); sheetData4.getRange(row,11).setValue(chromebooks[i].lastSync); sheetData4.getRange(row,12).setValue(chromebooks[i].osVersion); sheetData4.getRange(row,13).setValue(chromebooks[i].platformVersion); sheetData4.getRange(row,14).setValue(chromebooks[i].activeTimeRanges); sheetData4.getRange(row,15).setValue(chromebooks[i].model); sheetData4.getRange(row,16).setValue(chromebooks[i].etag); sheetData4.getRange(row,17).setValue(chromebooks[i].firmwareVersion); sheetData4.getRange(row,18).setValue(chromebooks[i].status); sheetData4.getRange(row,19).setValue(chromebooks[i].ethernetMacAddress); sheetData4.getRange(row,20).setValue(chromebooks[i].notes); sheetData4.getRange(row,21).setValue(chromebooks[i].systemRamTotal / (1024*1024) /1024); // "/ (1024*1024)" converts bytes to Mb "/1024" then converts back to Gb sheetData4.getRange(row,22).setValue(chromebooks[i].cpuStatusReports);}
row++ Logger.log(row) } } }
The results in the log file....
[{cpuUtilizationPercentageInfo=[63], cpuTemperatureInfo=[{temperature=24, label=soc_dts0 }, {temperature=24, label=soc_dts1 }], reportTime=2019-03-10T18:11:49.480Z}]
How do i reference cpuUtilizationPercentageInfo, cpuTemperatureInfo from cpuStatusReports?
Thankyou