最佳答案
这实际上是可能的,并记录在 Spreadsheets/batchUpdate/Requests#AddSheetRequest 下
authorize(JSON.parse(clientSecretContent), (auth) => {
const sheets = google.sheets({ version: 'v4', auth });
const request = {
// The ID of the spreadsheet
"spreadsheetId": spreadsheetId,
"resource": {
"requests": [{
"addSheet": {
// Add properties for the new sheet
"properties": {
// "sheetId": number,
// "title": sheetTitleSting,
// "index": number,
// "sheetType": enum(SheetType),
// "gridProperties": {
// object(GridProperties)
// },
// "hidden": boolean,
// "tabColor": {
// object(Color)
// },
// "rightToLeft": boolean
}
}
}]
}
};
sheets.spreadsheets.batchUpdate(request, (err, response) => {
if (err) {
// TODO: Handle error
} else {
// TODO: Handle success
}
});
});
关于node.js - 如何将新工作表添加到现有电子表格中?带有 Node.js 的 Google 表格 API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54819628/