[英]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.