简体   繁体   English

在谷歌电子表格上使用谷歌脚本发送短信

[英]send sms using Google Scripts on google spreadsheet

i want a script that sends a message to a particular cell number on event of an update in my spreadsheet or through a add menu button option.我想要一个脚本,它可以在我的电子表格中的更新事件或通过添加菜单按钮选项向特定单元格编号发送消息。 i tried to find but couldn't see any option like that.我试图找到但看不到任何类似的选项。

One of the simplest ways is to write a script to send it via email using your cell carriers email code.最简单的方法之一是编写脚本,使用您的手机运营商电子邮件代码通过电子邮件发送。

Here's a list of codes https://20somethingfinance.com/how-to-send-text-messages-sms-via-email-for-free/ .这是代码列表https://20somethingfinance.com/how-to-send-text-messages-sms-via-email-for-free/

Under tools select script editor and basically just copy the following code in. Change up the EmailTo, Subject, and Body accordingly.在工具下选择脚本编辑器,基本上只需将以下代码复制进去。相应地更改 EmailTo、Subject 和 Body。

function sendText() {
  var EmailTo = "your10digitNumber@CellcarrierCode";
  var subject = "Whatever";
  var body = "Text";

  MailApp.sendEmail(EmailTo, subject, body);
}

In the script editor under Edit select current project triggers and setup however you want.在编辑下的脚本编辑器中,选择当前项目触发器并根据需要进行设置。

Adding a menu or setting up an onEdit even function in a document is pretty straightforward (just a few lines of code depending on the complexity of your application).在文档中添加菜单或设置 onEdit 偶数函数非常简单(只需几行代码,具体取决于应用程序的复杂性)。 Google Apps Script does not have built in functionality for SMS/Text messaging however.但是,Google Apps 脚本没有内置的 SMS/文本消息功能。

If you want to accomplish this sms functionality, you will need to identify a company that offers an SMS/Text messaging API and access the API with a custom script.如果您想完成此短信功能,您将需要确定提供短信/短信 API 的公司并使用自定义脚本访问 API。 Twilio is a great tool (although not free) or you may find another API that fits your needs based on your region in this list of SMS APIs: http://blog.mashape.com/list-of-50-sms-apis/ . Twilio 是一个很棒的工具(虽然不是免费的),或者您可以在此 SMS API 列表中根据您所在的地区找到适合您需求的另一个 API:http: //blog.mashape.com/list-of-50-sms-apis /

Once you have your service/API selected and set up and have the API Documentation, refer to the following Google Developers page to access the service API with Apps Script: https://developers.google.com/apps-script/guides/services/external .选择并设置服务/API 并获得 API 文档后,请参阅以下 Google 开发人员页面以使用 Apps 脚本访问服务 API: https ://developers.google.com/apps-script/guides/services /外部

If you're not well versed in using APIs, you can instead use MailApp to send e-mail or log any activity in another spreadsheet for tracking purposes.如果您不精通 API 的使用,您可以改为使用 MailApp 发送电子邮件或在另一个电子表格中记录任何活动以进行跟踪。 One other low-tech solution to consider is that spreadsheets have a built-in edit notification under Tools > Notification Rules .另一个需要考虑的低技术解决方案是电子表格在Tools > Notification Rules下具有内置的编辑通知。

I attempted to我试图

try{

      MailApp.sendEmail(phone+'@txt.att.net',subject,body);
    }
    catch(err){}

The email sent.发送的电子邮件。 It worked.有效。 BUT it did not send the text.但它没有发送文本。 HOWEVER, if I REPLIED to the email (from sent mail) to the phone plus carrier code it did go through.但是,如果我回复电子邮件(来自已发送的邮件)到手机加上运营商代码,它确实通过了。 But only the reply.但只有回复。

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

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