【问题标题】:Using node.js to automatically update MSSQL table on Google Spreadsheet data change使用 node.js 自动更新 Google 电子表格数据更改的 MSSQL 表
【发布时间】:2022-01-23 15:18:56
【问题描述】:
请问有没有办法使用node.js或者javascript来自动检测google电子表格数据的变化并更新MSSQL数据库表的变化?
我已经阅读了几篇文章,但都需要使用第三方应用程序。
任何帮助将不胜感激。谢谢!
【问题讨论】:
标签:
javascript
node.js
google-sheets
google-drive-api
google-sheets-api
【解决方案1】:
您可以使用 NodeJS 中的 Watch 方法订阅对文件的更改。
const res = await drive.files.watch({
acknowledgeAbuse: false,
fileId: 'id-value',
supportsAllDrives: false,
requestBody: {
"address": "my_address",
"expiration": "my_expiration",
"id": "my_id",
"kind": "my_kind",
"params": {},
"payload": false,
"resourceId": "my_resourceId",
"resourceUri": "my_resourceUri",
"token": "my_token",
"type": "my_type"
}
},
});
console.log(res.data);
您可以在https://googleapis.dev/nodejs/googleapis/latest/drive/classes/Resource$Files-1.html#watch 上的 Node JS 文档中查看如何实现该服务