Being helped by ChatGPT I've created this Google Sheets script, helps me detecting some information from the docx file linked on the first column.
It worked for months but, some weeks ago it suddenly stopped working, giving me this error
Exception: Document is missing (perhaps it was deleted, or maybe you don't have read access?)
I have access and the documents are not deleted. But it still won't work.
Do you have any Idea on how to solve it?
function FineFiller() {
var sheet = SpreadsheetApp.getActiveSheet();
var range = sheet.getRange("A2:A");
var links = range.getValues();
for (var i = 0; i < links.length; i++) {
var doc = DocumentApp.openByUrl(links[i][0]);
var text = doc.getBody().getText();
var verbaleNum = text.substring(text.indexOf("Verbale n°: ") + 12, text.indexOf("Verbale n°: ") + 30);
sheet.getRange(i + 2, 2).setValue(verbaleNum);
var giorno = text.substring(text.indexOf("Il giorno ") + 10, text.indexOf("Il giorno ") + 20);
sheet.getRange(i + 2, 3).setValue(giorno);
var ore = text.substring(text.indexOf("alle ore ") + 9, text.indexOf("alle ore ") + 14);
sheet.getRange(i + 2, 4).setValue(ore);
var targa = text.substring(text.indexOf("targa ") + 6, text.indexOf("targa ") + 12);
sheet.getRange(i + 2, 5).setValue(targa);
var totale = text.substring(text.indexOf("per un totale di euro ") + 22, text.indexOf("per un totale di euro ") + 27);
sheet.getRange(i + 2, 6).setValue(totale);
}
}
I've tried to check if it was a problem related with the access to files, but it is not that.
EDIT: I'm adding this screenshot just to give a bit of graphic view of the results of the script before and after the error started to block my script from working. Being a company spreadsheet I can't share it and some data are hidden.