小编Kos*_*Kos的帖子

让 Google Apps 脚本在移动设备上运行

我正在尝试获取我为 Google 工作表制作的脚本,以便在打开工作表时触发(因为我发现您无法通过移动应用程序手动触发它们)。不知何故,我设法让一半的脚本工作,而另一半则没有。该脚本适用于桌面和移动设备,我希望它清除一组预定的单元格范围,同时隐藏一组预定的行和列(用于格式化目的)。该脚本在桌面上完美运行,但即使脚本的 hideRows/Columns 部分在移动设备上运行,脚本的 clearRanges 部分也无法运行。关于为什么会这样的任何想法?我正在使用的功能可以在下面看到:

function onOpen() {
//Create custom menu options
SpreadsheetApp.getUi().createMenu('Invoicing')
    .addItem("Clear Data", "clearRange")
    .addItem("Submit", "sendEmailWithPdfAttach")
    .addToUi()

//Clear ranges
var source = SpreadsheetApp.getActiveSpreadsheet();
source.getRange('A23:A40').clearContent();
source.getRange('H6:I6').clearContent();
source.getRange('H8:I8').clearContent();
source.getRange('F13:F13').setValue('FALSE');
source.getRange('F15:F15').setValue('TRUE');
source.getRange('D19:I19').clearContent();
source.getRange('D23:G23').clearContent();
source.getRange('D31:G31').clearContent();
source.getRange('A42:I44').clearContent();
source.getRange('B24:G25').clearContent();
source.getRange('B28:G29').clearContent();
source.getRange('B32:G33').clearContent();
source.getRange('B35:G40').clearContent();
source.getRange('H24:H29').clearContent();
source.getRange('H32:H33').clearContent();
source.getRange('H35:H39').clearContent();

//Hide rows/columns
var sheets = source.getSheets();
sheets.forEach(function (s, i) {
    if (i == sheetNum) {
        s.hideRows(45, 400);
        s.hideColumns(10, 17);
    } else {
        s.hideSheet();
    }
});    
}
Run Code Online (Sandbox Code Playgroud)

自定义菜单选项供桌面使用,可以忽略。我还要说这是我第一次真正使用 Apps Script,并且大部分代码都是从其他地方获取并修改的。如果你们对我能做什么有任何线索,我全神贯注。谢谢

mobile google-sheets google-apps-script google-sheets-api

4
推荐指数
2
解决办法
2万
查看次数

在 Google Cloud SQL 中读取通信数据包时出错

从 3 月 31 日开始,我在 Google Cloud SQL 中遇到以下错误:

读取通信数据包时出错。

我已经使用 Google Cloud SQL 2 年了,但从未遇到过这样的问题。我很担心。

这是详细的错误消息:

textPayload:  "2019-04-29T17:21:26.007574Z 203385 [Note] Aborted connection 203385 to db: {db_name} user: {db_username} host: 'cloudsqlproxy~{private ip}' (Got an error reading communication packets)"
Run Code Online (Sandbox Code Playgroud)

connection database-connectivity google-cloud-sql google-cloud-platform

4
推荐指数
1
解决办法
8329
查看次数

使用Google Apps脚本将Google云端硬盘图片插入文档

我试图以编程方式将图像插入文档中.我可以使用带有URL的图像(例如http://www.geeks-on-wheels.net/wp-content/uploads/apple.jpg)使其正常工作.

尝试使用位于Google云端硬盘上的图片时出现此问题.

URL如下所示:

https://docs.google.com/a/finance-in-motion.com/file/d/0B5sPSMZ9pf-QMG9GOVROakxQYmM/edit

要么

https://docs.google.com/a/finance-in-motion.com/file/d/0B5sPSMZ9pf-QMG9GOVROakxQYmM/edit?usp=sharing.

该脚本似乎不知道如何处理它并抛出错误.任何帮助,将不胜感激.

google-apps-script

3
推荐指数
1
解决办法
9761
查看次数

Google Apps脚本:使用Calendar API设置活动的颜色

我想为事件设置特定的颜色.

我相信我必须使用Calendar API.我无法弄清楚如何做到这一点.

我正在尝试的代码是:

var event = CalendarApp.getOwnedCalendarById(calendarID).createEvent(class, startTime, endTime, {description:lessonPlanDataComplete[t], colorId: 11});
Run Code Online (Sandbox Code Playgroud)

colorId11应该设置为红色,但所有事件出来作为默认颜色.

任何帮助/提示感激不尽,

非常感谢,西蒙

google-calendar-api google-apps-script

3
推荐指数
3
解决办法
5423
查看次数

从谷歌脚本中的单元格获取值

我正在尝试为我的工作制作工作表。在 Google 脚本中,我为我的工作表创建了“自定义菜单”,以便正确发送电子邮件。但是现在我想从特定单元格中获取值并检查它是否低于,例如,2,发送带有该值的电子邮件。现在,我有这个:

function onOpen() { 
  var ui = SpreadsheetApp.getUi();
  // Or DocumentApp or FormApp.
  ui.createMenu('Custom Menu')
      .addItem('First item', 'menuItem1')
      .addSeparator()
      .addToUi();
}
function menuItem1() {
  SpreadsheetApp.getUi() // Or DocumentApp or FormApp.
     .alert('You clicked the first menu item!');
  if( 'A1' > 3){
  MailApp.sendEmail('luk...@gmail.pl', 'subject', 'message');
  }
}
Run Code Online (Sandbox Code Playgroud)

我不知道如何从这个单元格中获取这个值。这个“如果”只是我正在尝试做的一个例子,我知道它不起作用。提前感谢您的任何帮助。

email google-sheets google-apps-script

3
推荐指数
1
解决办法
7912
查看次数

Git 日志在控制台上不显示任何内容

我正在使用 Kubuntu 16.4。长期服务。最近,我使用以下命令更新了我的软件包:

sudo aptitude update && sudo aptitude upgrade
Run Code Online (Sandbox Code Playgroud)

从那时起,该命令git log不提供任何输出。

git log > /tmp/gitlog.txt但是,在使用时,该文件包含所需的输出。

我怎样才能git log回去工作?

git ubuntu konsole

3
推荐指数
1
解决办法
1636
查看次数

Android 浏览器中的深层链接无法打开应用程序

ResultPayActivity在清单中定义了意图过滤器,如下所示:

<activity android:name=".ResultPayActivity"
android:screenOrientation="portrait">
<intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data android:scheme="sanduqcheh"  />
</intent-filter>
Run Code Online (Sandbox Code Playgroud)

我的应用程序包是:com.example.pegah_system.sanduqchehproject。此应用程序已安装。

现在我想通过这个深层链接在浏览器中调用应用程序:

intent://1#Intent;scheme=sanduqcheh;package=com.example.pegah_system.sanduqchehproject;end

但是当我在浏览器中调用 App 时无法执行,并且在 Google.com 上搜索 URL。

我已经阅读了关于此的其他问题,但我的问题没有解决。

我该如何解决这个问题?

android

3
推荐指数
2
解决办法
4841
查看次数

使用Google Apps脚本将用户添加到Google网上论坛

我正在尝试使用Google Apps脚本将用户添加到Google网上论坛。

这是我尝试过的代码:

// Adds a user to a Google Group
function addUsertoGroup(userEmail) {
  var userEmail = 'Name@gmail.com'
  var groupId = "group-name@googlegroups.com";
  var group = GroupsApp.getGroupByEmail(groupId);

  // If email is already in group
  try { var hasMember = group.hasUser(userEmail);}
  catch(e){Logger.log(userEmail+" is already in the group"); return}

  var newMember = {email: userEmail, role: "MEMBER"};

  // This is the line which is throwing an error
  AdminDirectory.Members.insert(newMember, groupId);
Run Code Online (Sandbox Code Playgroud)

运行时,我收到一个错误:

对directory.groups.get的API调用失败,并出现以下错误:未找到域。

任何帮助,将不胜感激。

google-api google-groups google-apps-script

3
推荐指数
1
解决办法
169
查看次数

用谷歌脚本播放声音

有没有一种简单的方法可以将声音文件合并到 Google Apps 脚本中?我看过一个帖子来尝试以下操作:

var audio = new Audio("alert.ogg");
audio.play();
Run Code Online (Sandbox Code Playgroud)

我收到错误:

参考错误:未定义“音频”

audio google-apps-script

2
推荐指数
1
解决办法
8260
查看次数

方程有不同数量的参数

我制作了这些数据类型来表示吉他标签,我正在尝试编写show功能,将它们打印为真正的吉他标签.datas不是我的专长,我在匹配类型时遇到了麻烦.

错误是

"show"的等式在GHC.Show.Show Tabs.Chord'的实例声明中有不同数量的参数

代码:

type Strings = Int

data Fret = None | Note Int

instance Show Fret where
  show None = "-"
  show (Note a) = show a

data Chord = EmptyChord Strings | Chord [Fret]

instance Show Chord where
  show EmptyChord a = init $ take (a * 2) ['-', '\n' ..]
  show Chord (x : xs) = x : '\n' : show xs
Run Code Online (Sandbox Code Playgroud)

haskell types

2
推荐指数
1
解决办法
3060
查看次数