How can I use Google Translate API to Translate text in Microsoft Excel

时光总嘲笑我的痴心妄想 提交于 2019-12-02 02:04:52

In order to translate content from your Excel spreadsheets, your options would be one of the following:

  1. Use built-in Microsoft text translation
  2. Write a VBA script that communicates with the Microsoft Text Translator API
  3. Write a VBA script that communicates with the Google Translation API

Depending on the use case and how confident you are with Microsoft's translation feature, I'd probably use the built in solution as it would likely be the simplest route. Depending on the version of Excel you have, it could even be built into the menus.

If not, you could use VBA script to use the Microsoft Text Translator REST API as suggested by @sysmod in a previous answer. As I'm not entirely familiar with that API, I'd strongly recommend reading the linked documentation.

If you prefer to use the Google Translation API, there is a REST API that you can use as linked above. You'd essentially need to use VBA script to issue a GET or POST request to https://translation.googleapis.com/language/translate/v2.

Keep in mind that in the case of both REST APIs (Microsoft and Google alike), you would need very specific query parameters as shown in their respective linked documentation and you'd also need to authentication your project/application using a subscription key or API key. This is the only way for Microsoft of Google to keep track of how much free quota your application has used.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!