简体   繁体   English

Google Apps 脚本错误的第二个冒号后面的数字是多少?

[英]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.我有一个链接到接受表单响应的工作表的 Google Apps 脚本。 I'm getting this error:我收到此错误: 错误截图 I've figured out that 104 is the line number where the error occurs.我发现 104 是发生错误的行号。 What does 14 represent? 14代表什么? 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:14

104 : represents the row where the error occured. 104 :代表发生错误的行。

14 : represents the column where the error occured. 14 :代表发生错误的列。

Column is defined as the position of each character in the document on the horizontal axis.列定义为横轴上文档中每个字符的 position。 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 .这里的错误在第2行,并且在单词error之前有2空格(列)。

  • But the error starts at the letter e of the word error .但是错误单词error的字母e开始。 So you have 2 spaces (columns) before error plus a letter which is the position where the error started.因此, error前有2空格(列)加上一个字母,即错误开始的 position。 Two spaces and one letter equals to 3 columns.两个空格和一个字母等于3列。 Therefore, you have an error that is located in the 3rd column.因此,您有一个位于第3rd列的错误。

    在此处输入图像描述

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.在您的情况下,错误位于第104行,并且在引入错误的命令之前有13符号/空格/字母或数字。 Everything before column 14 is correct. 14列之前的所有内容都是正确的。 The error starts at column 14 .错误从第14列开始。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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