[英]How exactly to use updateDimensionProperties in google-spreadsheet
I tried to add columns in my Google Sheet, using this .我尝试使用这个在我的 Google 表格中添加列。 But I always get error
UnhandledPromiseRejectionWarning: TypeError: doc.updateDimensionProperties is not a function
但我总是收到错误
UnhandledPromiseRejectionWarning: TypeError: doc.updateDimensionProperties is not a function
Here is my code:这是我的代码:
const doc = new GoogleSpreadsheet('google-id');
async function updateTable(token){
await doc.useServiceAccountAuth(require('./credentials.json'));
await doc.updateDimensionProperties("COLUMNS", 5, 1);
}
I believe your goal and your situation as follows.我相信你的目标和你的情况如下。
updateDimensionProperties()
using google-spreadsheet .updateDimensionProperties()
。updateDimensionProperties()
is required to be used for sheet
object.updateDimensionProperties()
用于sheet
对象。 Ref updateDimensionProperties()
are columnsOrRows
, props
, bounds
, bounds.startIndex
and bounds.endIndex
.updateDimensionProperties()
的参数是columnsOrRows
、 props
、 bounds
、 bounds.startIndex
和bounds.endIndex
。 When above points are reflected to your script, it becomes as follows.当以上几点反映到你的脚本中时,它变成如下。
await doc.useServiceAccountAuth(require('./credentials.json')); await doc.updateDimensionProperties("COLUMNS", 5, 1);
To:
await doc.useServiceAccountAuth(require('./credentials.json')); await doc.loadInfo(); const sheet = doc.sheetsByIndex[0]; await sheet.updateDimensionProperties("COLUMNS", { pixelSize: 200 }, { startIndex: 2, endIndex: 3 });
props
of updateDimensionProperties()
.updateDimensionProperties()
props
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.