I am trying to create an Apps Script project that grabs a MySQL query from a list and executes them.
The very last cell in the list contains the word "EXIT".
My intention is to exit the for loop with the If break.
It is processing the update query's and executing them, but will not exit the loop to continue
Any guidance would be greatly appreciated.
Logger.log(ipAddress)
Logger.log(userPassword)
Logger.log(user)
Logger.log(dbUrl)
var connection = Jdbc.getConnection(dbUrl, user, userPassword);
var stmt = connection.createStatement()
Logger.log(connection);
for (var i = 2;; i++) {
var queryCell = querySheet.getRange(i, 1).getValue();
Logger.log(queryCell);
if (queryCell == "EXIT") {
log.setValue(queryCell);
break;
}
var rs = stmt.executeUpdate(queryCell);
}
rs.close();
stmt.close();
connection.close();
Logger.log("Loop Exited")
var toast = SpreadsheetApp.getActiveSpreadsheet().toast('Complete', 'Status', 10);
var time = new Date();
loadEndCell.setValue(time);