How do you manipulate an inserted object in Google Sheets?

纵饮孤独 提交于 2019-12-14 02:37:01

问题


Insert an object in sheets (ex: https://developers.google.com/apps-script/reference/spreadsheet/sheet#insertImage(String,Integer,Integer)):

var obj = sheet.insert{ObjectType}(args.);

You can call your charts in sheets:

var chart = sheet.getCharts()[0].modify().{params}.build;

And can call objects in docs:

docs.getBody().findElement(DocumentApp.ElementType.{object type}, null);

What's the equivalent for finding objects in sheets, i.e. is there a gsheets dom model like there is for docs? or are non-chart objects inaccessible through gAppscript?

//get objects in sheet    
var obj2 = sheet.getObject()[0]
//error, method doesn't exist
//
//get objects near a range
var obj3 = sheet.getRange(x,y).getObject()
//error

回答1:


Maybe I'm missing something here, but data in Sheets isn't organized the same way it is in Docs. What kind of "objects" are you trying to find? I think you should be able to retrieve and manipulate most anything with a combination of getRange, getValues, and setValues.



来源:https://stackoverflow.com/questions/27184693/how-do-you-manipulate-an-inserted-object-in-google-sheets

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!