简体   繁体   English

有没有一种方法可以从Google文档中的页面/使用Google Apps脚本提取JavaScript变量?

[英]Is there a way to extract JavaScript variables from a page in Google Docs/with Google Apps Script?

I'm very new to JavaScript, and much more of an analyst than a programmer. 我对JavaScript非常陌生,比起程序员,他更是一名分析师。

You know how you can open up Chrome's Console and type in a JavaScript variable, and the value of that variable will be returned? 您知道如何打开Chrome的控制台并键入JavaScript变量,然后将返回该变量的值吗? I want to know if it's possible to grab those variables from within Google Drive/Docs or Google Apps Script. 我想知道是否有可能从Google云端硬盘/文档或Google Apps脚本中获取这些变量。

I've seen a few examples on StackOverflow of getting the values of certain XML elements (say, the text within a title tag), but I don't want to grab the entire contents of the script that contains these variables (as would be returned with an XPath query), just the variables themselves. 我已经在StackOverflow上看到了一些示例,这些示例获取某些XML元素的值(例如,标题标签中的文本),但是我不想获取包含这些变量的脚本的全部内容(因为XPath查询返回),只是变量本身。

Is this possible? 这可能吗?

You can exchage data between your web screen and you server side apps script by using the call 您可以通过调用在Web屏幕和服务器端应用程序脚本之间交换数据

google.script.run.yourServerSideFunction(your parameters).

You can see more about server and client communications here . 您可以在此处查看有关服务器和客户端通信的更多信息。

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

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