[英]How exactly to use updateDimensionProperties in google-spreadsheet
我嘗試使用這個在我的 Google 表格中添加列。 但我總是收到錯誤UnhandledPromiseRejectionWarning: TypeError: doc.updateDimensionProperties is not a function
這是我的代碼:
const doc = new GoogleSpreadsheet('google-id');
async function updateTable(token){
await doc.useServiceAccountAuth(require('./credentials.json'));
await doc.updateDimensionProperties("COLUMNS", 5, 1);
}
我相信你的目標和你的情況如下。
updateDimensionProperties()
。updateDimensionProperties()
用於sheet
對象。 參考updateDimensionProperties()
的參數是columnsOrRows
、 props
、 bounds
、 bounds.startIndex
和bounds.endIndex
。當以上幾點反映到你的腳本中時,它變成如下。
await doc.useServiceAccountAuth(require('./credentials.json')); await doc.updateDimensionProperties("COLUMNS", 5, 1);
到:
await doc.useServiceAccountAuth(require('./credentials.json')); await doc.loadInfo(); const sheet = doc.sheetsByIndex[0]; await sheet.updateDimensionProperties("COLUMNS", { pixelSize: 200 }, { startIndex: 2, endIndex: 3 });
updateDimensionProperties()
props
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.