A
A
Alexey Emelyanov2022-01-21 22:18:20
Google Apps Script
Alexey Emelyanov, 2022-01-21 22:18:20

How to pull comments from another Google Sheets?

The task is to pull notes from another table. I don't know how to do it. Could you explain?
Inside one table code:

function getNotes(sheetName, rangeName){
  return SpreadsheetApp.getActiveSpreadsheet()
    .getSheetByName(sheetName).getRange(rangeName).getNotes()
}


(in the table itself) =getNotes("***";"***")works with a bang. But what about notes from another table? ((
I tried SpreadsheetApp.getActiveSpreadsheetto replace it with SpreadsheetApp.openById, but it doesn’t work like that.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Ivanov, 2022-03-16
@EmelyanoffA

Judging by the comments, an error is returned

Exception: You do not have permission to call SpreadsheetApp.openById. Required permissions: https://www.googleapis.com/auth/spreadsheets

This means that the function is run as a user-defined function. These functions cannot read adjacent Tables. For this, other approaches must be used.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question