1

似乎沒有太多r.e.谷歌文檔邊欄。在谷歌文檔邊欄中使用谷歌電子表格值作爲下拉菜單

除了Mogsdad完成的夢幻般的工作。

他的光標位置工具是我需要的1/2(How to poll a Google Doc from an add-on)。

我有一個帶有〜200個可能的佔位符的Google表格模板,需要放入Google文檔,填充然後PDF'd。

我在哪裏找不到任何地方是如何從谷歌工作表範圍到文檔邊欄。通過這種方式,當模板正在構建時,我可以設置一些可變的動態下拉菜單,將正確的佔位符放置在光標位置。

任何人都能指出我正確的方向嗎? (是的,我知道專家:P)

回答

1

使用Google Apps腳本Spreadsheet service,首先打開電子表格,然後獲取範圍,最後獲取值。

實施例:

/** 
* Get the values from a range speficied by the Spreadsheet ID and the range reference or 
* name 
* 
* @param {'1FkUd199CS3U25bfb5WxP-Jy--qcgD4NTHYWNMw8AtiA'} id Spreadsheet id 
* @param {'Sheet1!A1:A100'} stringReference Reference string 
* @return 2D array with the values of the specified range 
*/ 
function getSpreadsheetValues(id,stringReference){ 
    var ss = SpreadsheetApp.openById(id); 
    var range = ss.getRange(stringReference); 
    return range.getValues(); 
} 
相關問題