我是google电子表格API节点模块的新手。我在问如何编辑工作表的单元格值。我试着跟踪其他的网络视频,但它们都不起作用。我有一个名为doc的变量,即电子表格,该表本身称为SheettoUse。
const doc = new GoogleSpreadsheet('CODE');
await doc.useServiceAccountAuth({
client_email: creds.client_email,
private_key: creds.private_key,
});
await doc.loadInfo(); // loads document properties and worksheets
const TicketASheet = doc.sheetsByTitle['Ticket-A']; // or use doc.sheetsById[id]
let sheet = TicketASheet
await sheet.loadCells('A1:AAA1000');
let cells = sheet.getCell(0,0)
console.log(cells.value)谢谢,威廉
发布于 2021-03-22 22:28:03
.setValue()用于更新应用程序脚本中的单元格值。
要在npmjs中设置单元格值,可以参考以下示例代码:
// update cell value
cells.value = 123.456;
// update cell formula
cells.formula = '=A1';
// update cell format
cells.textFormat = { bold: true };
// update cell note
cells.note = 'This is a note!';
await sheet.saveUpdatedCells(); // saves changes in the cell参考:
https://stackoverflow.com/questions/66728868
复制相似问题