I would like to ask if there is any way to use node.js or javascript to automatically detect google spreadsheet data change and update the changes in MSSQL database table?
I have read several articles but it all requires the usage of third party applications.
Any help will be appreciated. Thank you!
CodePudding user response:
You can subscribe to changes to a file by using the Watch method in NodeJS.
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);
You can check how to implement the service from the Node JS documentation on https://googleapis.dev/nodejs/googleapis/latest/drive/classes/Resource$Files-1.html#watch