There’s so much about how AI is for coding and that coding is a solved problem there. I am less sure, but I usually am. I see AI regularly returning an entirely wrong language, let alone providing good, secure, modern, and clean code.
I keep messing around with it in various ways. Here is a quick generation of code example from today focused on a simple task.
So let’s breakdown how this standard prompt gets answered on various tools and how it compares to what I wrote as a human.
Give me the Google Apps Script to loop through all rows in a sheet and if column O contains ChatGPT or Claude to set the category of Column AA to Software.
Gemini
function setCategoryForChatGPTClaude() {
const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getActiveSheet();
const lastRow = sheet.getLastRow();
const columnOValues = sheet.getRange("O1:O" + lastRow).getValues();
const columnAARange = sheet.getRange("AA1:AA" + lastRow);
const columnAAVals = columnAARange.getValues();
for (let i = 0; i < columnOValues.length; i++) {
const columnOValue = columnOValues[i][0];
if (typeof columnOValue === 'string' && (columnOValue.includes("ChatGPT") || columnOValue.includes("Claude"))) {
columnAAVals[i][0] = "Software";
}
}
columnAARange.setValues(columnAAVals);
}
Claude
function categorizeAI() {
const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
const dataRange = sheet.getDataRange();
const values = dataRange.getValues();
// Start from row 1 (assuming row 0 is headers)
values.forEach((row, index) => {
if (index === 0) return; // Skip header row
const cellValue = row[14]; // Column O (0-indexed)
// Check if cell contains ChatGPT or Claude (case insensitive)
if (cellValue && (
cellValue.toString().toLowerCase().includes('chatgpt') ||
cellValue.toString().toLowerCase().includes('claude')
)) {
// Set column AA (index 26) to "Software"
sheet.getRange(index + 1, 27).setValue("Software");
}
});
}
ChatGPT
function categorizeSoftware() {
const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
const dataRange = sheet.getDataRange();
const values = dataRange.getValues();
// Column O is index 14 (0-based), Column AA is index 26
for (let i = 1; i < values.length; i++) { // Start from 1 to skip header
const colO = values[i][14]; // Column O
if (typeof colO === 'string' && (colO.includes('ChatGPT') || colO.includes('Claude'))) {
sheet.getRange(i + 1, 27).setValue('Software'); // Column AA (index 27), row = i + 1
}
}
}
Copilot
function categorizeSoftware() {
const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
const data = sheet.getDataRange().getValues(); // Get all data in the sheet
for (let i = 1; i < data.length; i++) { // Start from 1 to skip header row
const colO = data[i][14]; // Column O (15th column, index 14)
if (typeof colO === 'string' && (colO.includes('ChatGPT') || colO.includes('Claude'))) {
sheet.getRange(i + 1, 27).setValue('Software'); // Column AA (27th column)
}
}
}
Human
function addAiCategory() {
const ss = SpreadsheetApp.getActiveSpreadsheet();
const sheet = ss.getSheetByName('data');
const dataRange = sheet.getDataRange();
const values = dataRange.getValues();
values.forEach((row, index) => {
const description = row[14];
if (description.toString().toLowerCase().includes('chatgpt') ||
description.toString().toLowerCase().includes('claude')
) {
sheet.getRange(index + 1, 27).setValue("Software");
}
});
}
So what?
Well, I think these all work but it’s interesting to look at what paths were taken. It’s a small sample but kind of interesting.
In my head, the Google AI should be the best at making Google App Script code but I don’t think it was. I think it was the only one to use the lastRow variable. It also used the A1 notation rather than the numerical path. It also doesn’t address issues with capital letters in the search pattern.
Copilot and ChatGPT were really, really close in terms of code. That probably makes sense given their relationship.
It was odd to me that the old javascript loop pattern was used, that’s the for (let i = 0; i < columnOValues.length; i++) rather than the forEach option. That’s probably because there’s so many more examples of that but it’s weird to think that AI might be a force that actually slows down progression towards more modern programming patterns.
This is also just a super simple example. To think that AI is good to go with generating code from scratch at a really complex level seems like a bad mistake to me. It’s also another example of how we need to break down what we mean. Using AI to help review code is something different. Using AI to clean up code is yet another thing. Using AI to help code when you can code is another thing. Using AI to wade through documentation or provide examples is still another thing.