Javascript code not updating Google Sheet

I added the checkbox javascript code to my Knack app and everything is updating correctly. I have a Google Sheet link to it using Integromat. The problem I am encountering is that when I update the selected records, the updates aren't reflected on my Google Sheet. If I do inline editing on any of the records the Google Sheet will automatically update. It seems that the webhook is not being triggered. Any assistant will be greatly appreciated. My javascript code below:

// Function that adds checkboxes
var addCheckboxes = function(view) {
// Add the checkbox to to the header to select/unselect all
$('#' + view.key + '.kn-table thead tr').prepend('<th><input type="checkbox"></th>');
$('#' + view.key + '.kn-table thead input').change(function() {
$('.' + view.key + '.kn-table tbody tr input').each(function() {
$(this).attr('checked', $('#' + view.key + '.kn-table thead input').attr('checked') != undefined);
});
});
// Add a checkbox to each row in the table body
$('#' + view.key + '.kn-table tbody tr').each(function() {
$(this).prepend('<td><input type="checkbox"></td>');
});
}

// Checkboxes & Button
$(document).on('knack-view-render.view_#', function (event, view, data) {

// Add an update button
$('<button id="update"">Update</button>').insertAfter('.view-header');

// Add checkboxes to our table
addCheckboxes(view);

// Click event for the update button
$('#update').click(function () {

// Drop-Down Value Variable
var S = $('#view_#-field_# option:selected').text();
var E = $('#view_#-field_# option:selected').text();

// Array of record IDs
var record_ids = [];

// Populate the record IDs using all checked rows
$('#' + view.key + ' tbody input[type=checkbox]:checked').each(function() {
record_ids.push($(this).closest('tr').attr('id')); // record id
});

// turn on the Knack wait spinner
Knack.showSpinner();

// Fields to update
var data = {
field_#: S,
field_#: E
};

// set the delay to prevent hitting Knack API rate limit (milliseconds)
var myDelay = 100;

//call updateRecords function
$(function() {
updateRecords(record_ids.shift(), record_ids, data);
});

// use an ajax call to set the new value in knack for each checked record in the record ID array
var selectedRecords = record_ids.length + 1
function updateRecords(id, records, data) {
$.ajax({
url: 'https://api.knackhq.com/v1/objects/object_#/records/' + id,
type: 'PUT',
headers: {'X-Knack-Application-ID': '#',
'X-Knack-REST-API-Key': '#'},
data: data,
success: function(response) {
if (record_ids.length > 0) {
// every time a loop is made, the array is shifted by 1.
// if the array still has a length greater than 0, re-run another updateRecords loop
setTimeout(updateRecords(record_ids.shift(), record_ids, data), myDelay);
}
else {
alert('Updating ' + selectedRecords + ' records.');
Knack.hideSpinner();
window.location.reload(true);
// Knack records are updated now
}
}
})
}
})
});

Hi Tony,
I just tested your solution and it works perfectly. 

Thank you so much for taking the time to reply to my post.

Hi Lizy,

I do not see the reply post from Tony. Do you remember what you did to fix this?

Thanks,
Tim

Hi Tim,

Are you still having Google Sheet issues? You’re welcome to schedule a time here. I’ve fixed similar issues before.

Thanks,

Ian
Knack Pros