0

I'm trying to create a sidebar that will display cell values from the given row in which the user is currently on. For example, user is in cell B3. Side bar to show values from cells B1, B6 and B10. I've tried several solutions, the latest being this one. Sadly, none of these work. Any ideas?


Additional information, 03/09/21: I've created a sample spreadsheet with all the scripts. The sidebar is now loading, but I cannot get it to update using the getRecord function. Keep getting the following error: NetworkError: Connection failure due to HTTP 502

Thanks

user13708028
  • 315
  • 3
  • 13
  • 1
    You msy be able to onSelectionChange trigger – Cooper Sep 02 '21 at 12:55
  • Thanks, @YuriKhristich. I'm sure we'll find a way to solve the trigger for refreshing the sidebar. I'm currently stuck in getting the sidebar to show values from the given row. – user13708028 Sep 02 '21 at 12:58

1 Answers1

1

In your SidebarJavascript.html file, it doesn't look to me that you are passing the record to your callback. See if this helps:

function poll(interval) {
    interval = interval || 1000;
    setTimeout(function() {
      google.script.run
        .withSuccessHandler(showRecord) // <--replace this
        .withSuccessHandler(function (record) {   //<-- with this
          showRecord(record);
        })
        .withFailureHandler(
          function(msg, element) {
            showStatus(msg, $('#button-bar'));
            element.disabled = false;
          })
        .getRecord();
    }, interval);
  };

I don't know if this will make a difference.

Clark Lind
  • 86
  • 4
  • Thanks, but not sure I understand where should this be added, or if this is replacing existing lines of code. – user13708028 Sep 02 '21 at 13:10
  • Sorry. In SidebarJavascript.html, in function poll: Replace the success handler – Clark Lind Sep 02 '21 at 13:15
  • Thanks. It's indeed much more clearer now. However, still getting an error inside the sidebar: ScriptError: We're sorry, a server error occurred while reading from storage. Error code PERMISSION_DENIED. – user13708028 Sep 02 '21 at 14:26