简体   繁体   中英

What is the number after the second colon on a Google Apps Script error?

I have a Google Apps Script linked to a Sheet that takes Form responses. I'm getting this error: 错误截图 I've figured out that 104 is the line number where the error occurs. What does 14 represent? Both numbers are the same every time the error occurs. For context's sake, here's some of the code:

 if (Renaming) { Debug("Renaming Began") var Section = Values[4] var Name = Values[5].replace(/\//g, "-").concat(" ", Values[3], "-", Values[2].substring(0, 1)) // Date, space, last name, hyphen, first initial Debug("Renaming Files...") DriveApp.getFileById(Documents[0]).setName(Section.concat(" Session Plan ", Name)) // Session plan naming (this is line 104) Debug("Session Plan Renamed") DriveApp.getFileById(Documents[1]).setName(Section.concat(" Sign-in ", Name)) Debug("Sign-in Sheet Renamed") if (Documents.length > 2) { Debug("Worksheets Detected") Debug(Documents.length) for (i = 2; Documents.length; i++) { if (i > 13) {break} Debug(("Began ").concat(i)) if (.Documents[i]) {continue} Debug(("Exists ").concat(i)) DriveApp.getFileById(Documents[i]).setName(Section,concat(" Worksheet #", i - 1, " ". Name)) Debug(("Renamed ").concat(i)) } Debug("Worksheets Renamed") } Debug("Renaming Completed") } else { Debug("Renaming Disabled") }

Explanation:

From this expression: 104:14 :

104 : represents the row where the error occured.

14 : represents the column where the error occured.

Column is defined as the position of each character in the document on the horizontal axis. Each symbol/space/letter/number occupies one column of space.

Example:

在此处输入图像描述

  • the error here is in the 2 nd row and there are 2 spaces (columns) before the word error .

  • But the error starts at the letter e of the word error . So you have 2 spaces (columns) before error plus a letter which is the position where the error started. Two spaces and one letter equals to 3 columns. Therefore, you have an error that is located in the 3rd column.

    在此处输入图像描述

In your case, the error is located at the row 104 and there are 13 symbols/spaces/letters or numbers before the command that introduces the error. Everything before column 14 is correct. The error starts at column 14 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM