I’ve been vibe coding with Gemini and Google Scripts. It has allowed me to make some super useful things for my school.
The most frustrating part is when Gen AI changes how the code represents the underlying spreadsheet. I have not changed the spreadsheet, but Gen AI edits the code as if I had.
Sometimes it is small, like changing how the code references the spreadsheet tab name. For example the sheet says “StudentID” and all of a sudden the code refers to it as “Student-ID”. And sometimes it is way larger, changing the entire way the code expects to refer to the spreadsheet.
So, you will need the structure of your spreadsheet to give to Gen AI to get it back to what it should be. An App Script code can do this for you.
Log Sheet Structure
function logSheetStructure() { var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheets = ss.getSheets(); sheets.forEach(function(sheet) { var name = sheet.getName(); var lastCol = Math.max(1, sheet.getLastColumn()); var headers = sheet.getRange(1, 1, 1, lastCol).getValues()[0]; Logger.log("TAB: [" + name + "] ---> HEADERS: " + JSON.stringify(headers)); });
Open your Execution Log, clean up the logged text (it will include time stamps), and tell the AI to fix it. Here is one possible direction.
The code broke because you changed how it references my spreadsheet. The spreadsheet itself has NOT changed. Update the code to match this exact structure:
Not a perfect solution. But when something seems to break, that is often a thoughtful way to get things on the right path forward.