0

I used this code to insert documents directly into a Google spreadsheet without having to upload files and then create hyperlinks. However, as google moved to the new spreadsheet...

Warning: The UI service was deprecated on December 11, 2014. To create user interfaces, use the HTML service instead.

So know I need help fixing lines like; var app = UiApp.getActiveApplication();

If someone could clarify the different types of programming direction you could take this project from, that would also be very helpful, I am not really sure if I need to work with Javascript or HTML now.

Zig Mandel
  • 19,571
  • 5
  • 26
  • 36
Buckaroo9
  • 3
  • 3

2 Answers2

1

The answer to your question will depend in large part on how you are using UIApp. In most cases it's not as simple as changing a few lines of code but more of a script redesign.

If you are using it to create a custom user interface, your path forward would be to rebuild your interface as HTML/Javascript and serve it to the user with HTMLService. The service is overall much more powerful/flexible and provides a better end-user experience but it means rewriting how your script works. If you want to take a look at a helpful example on how the HTML Service works take a look at the HTML Service Guide or this quick-start example of an add on.

You can still link this html interface with your script using the google.script.run service but you will need to redesign your code/application to work with the new input methods. The good news is although UI service will sunset on June 30, 2015, "Service will no longer appear in autocomplete, although existing scripts should still function."

It's worth considering alternate ways to accomplish the same goal. The best way to do that is to start by asking "What is the intended use of this script? What problem does it solve?" There may be a better way to accomplish that task which may not even involve updating the script.

Brady
  • 322
  • 1
  • 11
1

This is not related to the new spreadsheet version, the message you get is because UiApp has recently been deprecated.

A Google search would have shown you a few tracks to find your way.

One of the best I found is this one from Sandy Good : Google apps script UI services to HTML services

It shows a typical example of conversion to HTMLService.

Community
  • 1
  • 1
Serge insas
  • 45,904
  • 7
  • 105
  • 131