我有一个基本的 Google Sheets 脚本,作为 HTML 侧边栏的一部分,我向用户显示要输入的公式;例如=myformula("bob", "ross")。这适用于美国和许多其他国家/地区的人们,但有相当多的国家/地区使用;它,因此公式看起来像=myformula("bob"; "ross")。我知道我可能可以通过脚本获取电子表格的区域设置,但是有没有办法知道我是否应该放置 a,或 a ;?谢谢!
javascript locale google-sheets google-apps-script google-sheets-formula
我正在尝试创建一个模型支付弹出窗口,用户可以在其中升级他们在谷歌应用程序脚本中的计划。在我的.gs文件中,我有:
function manageSubscription() {
var title = 'subscribe';
var html = HtmlService.createTemplateFromFile('subscribe');
html.email = Session.getActiveUser().getEmail();
var htmlOutput = html.evaluate();
htmlOutput.setTitle(title).setWidth(200).setHeight(200)
DocumentApp.getUi().showModalDialog(htmlOutput, title);
}
Run Code Online (Sandbox Code Playgroud)
在我的.html文件中,我试图在他们注册时使用该电子邮件地址将其传递给 paypal:
<script id="paypal_js"></script> // how do I set the src???
<script>
$(document).ready(function(){
var src = 'https://www.paypal.com/sdk/js?client-id=my-client-id&email=';
document.getElementById('paypal_js').src = src+<?= email ?>;
paypal.Buttons({
createSubscription: function(data, actions) {
return actions.subscription.create({'plan_id': 'P-my-plan'});
},
onApprove: function(data, actions) {
google.script.host.close();
}
}).render('#paypal-button-container');
});
</script>
Run Code Online (Sandbox Code Playgroud)
但是,我进入ReferenceError: paypal is not defined了浏览器控制台。奇怪的是,我可以做一个简单的 'alert();' 并看到我收到了电子邮件。