I'm trying to write a Google Apps script that involves getting the text from a table cell inside a Google Spreadsheet. To illustrate the situation, let's say the word "hello" is in the cell B4, and my function is supposed to get that string from that cell. How would I go about this? I've tried the following but that hasn't worked for me.
function getText() {
var body = DocumentApp.getActiveDocument().getBody();
var text = body.getText();
}
I get this error whenever I try to use the function.
Error: You do not have permission to call getActiveDocument
Even after getting authorization for the script, I still get the same error. Any ideas on how to solve this?