Within a SQL Server 2017 Integration Services project, using the CozyRoc REST Connection Manager, I'm trying to use their JavaScript Task to Delete a Sheet in one Google Spreadsheet then copy the same-named Sheet from another Spreadsheet into that first spreadsheet using "CopyTo", then rename the copied sheet to remove the "Copy of . . ." portion of the title.
Sheet 1 is called "CompanyInfo". It has 7 Sheets, one of which is called "Daily Report".
Sheet 2 is called "Daily Report" which has only one sheet called 'Daily Report".
The overall task is simply to automate the process from within SSIS of overwriting the "Daily Report" sheet of the "Company Info" spreadsheet with the "Daily Report" sheet from the "Daily Report" spreadsheet. This is simple enough to do manually from Google Sheets, but it needs to be automated through SSIS.
Looking at the API, this will probably involve deleting the original "Daily Report" sheet from "Company Info," copying the Daily Report sheet from the "Daily Report" spreadsheet into a new tab in the "Company Info" spreadsheet, and then renaming that sheet to remove the "copy of " portion. Three simple BatchUpdate commands is my guess. But everywhere I look all I see are complicated updates to individual sheets, not batch updates.
I've contacted Cdata Software, but their SSIS GoogleSheet task doesn't do a "Copyto". That would make things simple.
I've tried desperately to get some guidance from CozyRoc, but generally all I'm told is to go look at the API reference for Sheet Operations, and that I need to write a web request, which I don't understand how to do.
As a start, I've googled all over for a simple complete little full piece of sample JavaScript code that specifies a Google Spreadsheet ID, a Google Sheet ID, and then deletes the specified sheet from within a web request. All I find anywhere are the little snippets from the API reference, and that's not helping me write the full script.
To be clear, For a number of reasons, I can't do this directly from within Google Sheets using an app script.
I totally get it that this is wrong:
task.run = function () {
var connection
variables = this.variables;
var SheetID = 1145890987;
var SpreadsheetID = "1r0tsxZ_nKT7EGG5qU6_6JPJ3dLOsZfF8pmdfsdgfagdahjI"
if (this.parameters.RestConnection.value) {
connection = this.connections[this.parameters.RestConnection.value].acquire();
connection.connect();
}
else {
connection = new RestConnection();
}
{
"requests"; [
{
"deleteSheet": {
"sheetId": SheetID
}
}
]
}
I expect the "Daily Report" sheet of the "Company info" spreadsheet to be overwritten by the "Daily Report" sheet of the "Daily Report" spreadsheet whenever I run the SSIS project called "Update Daily Report."
How do I solve this problem?