Google Apps 宏 - 与 Office VBA 宏相比如何?
你们中有人使用 Google Apps 的 javascript 宏功能吗,尤其是电子表格?能力比较如何?有什么是 Google Apps 无法完成而 VBA 宏可以完成的吗?
Do any of you use the javascript macro capabilities of Google Apps, particularly for spreadsheets? How do the capabilities compare? Is there anything that Google Apps can't do that can be done with VBA macros?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
我正在将一个复杂的项目从 VBA 转换为 Google Apps 脚本,作为一个实验,看看什么可以做,什么不能做。
总的来说,Google Apps 脚本的开发环境是原始且令人沮丧的。该语言当然是 javaScript,所以如果您已经知道,那么您就已经领先了。但问题是,javaScript 的许多优点无法实现,因为您实际上无法访问 DOM 元素,也没有等效的 Excel 形状(除非通过 UI 对象),这本质上与Excel 形式,具有相同类型的事件和对象等。
另一个问题是普遍缓慢。您需要小心如何构建,以便最大限度地减少对电子表格数据的调用(我通过构建值缓存来解决这个问题),并且可扩展性非常值得怀疑。
我同样熟悉 javaScript 或 VBA,因此,抛开语言不谈,VBA 目前更令人满意,完成工作也更快,尽管应用程序脚本内置了越来越多的功能,使其非常有前途。
我正在记录我的迁移进度,以及我遇到的事情以及找出如何最小化结构变化的斗争(我试图看看我是否可以想出一些允许在两个平台上进行双重维护的东西),所以如果您有兴趣,可以在此处
http://ramblings.mcpher.com/Home/excelquirks/gooscript
布鲁斯
I am in the middle of conversion of a complex project from VBA to Google Apps Script as an experiment to see what can be done and what can't.
In general, the development environment for google apps script is primitive and frustrating. The language is of course javaScript so if you already know that then you have a head start. The problem though is that many of the advantages of javaScript are not realizable since you don't actually have access to DOM elements, and neither do you have an equivalent of Excel shapes - except through the UI object- which is essentially the same as an excel form, with the same kind of events and objects etc.
Another issue is general slowness. You need to be careful how you structure, so that you minimize calls to the spreadsheet data (I got round this by building a values cache), and scalability is very questionable.
I am equally at home with javaScript or VBA, so putting language aside, VBA is currently more fulfilling and quicker to get things done, although there are increasing capabilities built in to apps script to make it extremely promising.
I am logging the progress of my migration, and the things I come across and the battles to figure out how to minimize structural change (I am trying to see if I can come up with something that would allow dual maintenance on both platforms), so if you are interested, you can follow along here
http://ramblings.mcpher.com/Home/excelquirks/gooscript
Bruce
我正在尝试使用谷歌应用程序脚本在谷歌电子表格中创建图表,但这似乎是不可能的...在VBA中相当容易,也许vb6已经有10年历史了,但另一方面,你可以做你需要的一切与您的电子表格。但谷歌脚本中的情况并非如此。
I'm trying to create charts in google spreadsheet using google apps script and is seems not possible... It is fairly easy in VBA, maybe vb6 is 10 years old but on the other hand you're able to do everything what you need with your spreadsheet. This is not the case in google scripts though.
Office 中的 VBA 已经差不多有 10 年了,仍然使用旧的 VB6。该语言的局限性是无穷无尽的。无数据结构,无逻辑短路,类型有限,非面向对象。 Google Apps 和 javascript 大概处于技术的最前沿,因此它不应该有很多这些限制。
至于哪些人能够做而其他人则不能,这有点难以断言。我认为这两种语言或多或少都是图灵完备的,因此虽然用每种语言做某事可能或多或少困难,但理论上,一个足够好的程序员团队可以用任何一种语言做任何事情。
干杯:D
The VBA in Office has been the same for about 10 years now, still using old VB6. The limitations of that language are endless. No data structures, no logic short-circuiting, limited types, non-object oriented. Google Apps and javascript are presumably on the forefront of technology and so it should not have many of these limitations.
As for what each is capable of doing that the other can't, that's a little more difficult to assert. I would argue that both languages are more or less turing complete, so while it may be more or less difficult to do something in each language, in theory, a good enough team of programmers could do just about anything in either.
Cheers :D
主要障碍之一是 Google Apps 是基于网络的。大多数公司都担心自己的数据不能安全地存储在自己的网络中。我永远不会相信谷歌会提供此类数据。我确信他们有安全的数据连接器,但为什么要冒这个风险呢?
当然,VBA 已经过时了,而且不如 javascript 那么性感。然而,它是快速编写小型应用程序并将其快速交付给用户的绝佳工具。您只会听到关于由非程序员使用 VBA 构建的应用程序的噩梦故事。
这实际上取决于您的项目以及您想要完成的任务。两者都有其局限性。
One of the major hurdles is that Google Apps is web based. Thats were most companies cringe at the thought that you would have your own data not stored securely within your own network. I would never trust Google with that sort of data. I'm sure they have secure data connectors, but why take that risk?
Sure VBA is outdated, and not as sexy as javascript. However, its a great tool for quickly writing small applications, and getting it to the user fast. You only really hear nightmare stories about applications that were built by non-programmers using VBA.
It really depends on your project, and what you want to accomplish. Both have their limitations.
快速浏览一下 Google Spreadsheet API 后,我的印象是它目前有些有限,例如:
事件较少,无法控制计算?无法编写 UDF?
有人尝试过使用它来进行严肃的工作吗?
Having taken a quick look at Google Spreadsheet API I get the impression that its currently somewhat limited, for instance:
fewer Events, no control of calculation?, no way of writing UDFs?
Has anyone tried using it for serious work?
就其本质而言,Google 电子表格无法完成本地程序可以完成的许多操作。示例:一个宏,它将导入用户指定文件夹中的所有 csv 文件并合并它们。
By its nature, a Google spreadsheet will not be able to do many things a local program will do. Example: a macro that would import all csv files in a user specified folder and consolidate them.
我想到的一件事是,VBA 可以通过“Declare Function”声明完全访问 WinAPI。 Google Apps 脚本没有此访问权限。如果您要在两者之间转换电子表格,则需要注意这一点。
One thing that springs to mind is that VBA has full access to the WinAPI through 'Declare Function' declarations. Google Apps script won't have this access. This is something to watch for if you're converting a spreadsheet between the two.