0

Context: I want to be able to extract text via OCR from a screenshot that I insert into a Google Sheet cell. I have tried for hours, searching the Internet, trying different tactics, but I cannot find a way to get a file ID, URL, or Blob for the screenshot that has been inserted into the cell (the sheet has only 1 cell). BTW I have already worked out the code I need once I get a fileID, URL, or Blob to do the OCR.

Questions:

  • First, is it possible to get a reference (file ID, etc.) to an image in a cell?
  • Second, when I select a function in a dropdown (e.g. .getContentURL) and it produces a “not a function” error, what does that indicate (e.g. there is no content, or something else)?
    function getImageHandle()
    {
        // get the sheet object
        var inputSheet = ss.getSheetByName("InPutSheet");
 
        // get the file ID of the cell content
         var fileID = inputSheet.getRange("A1").getValue().fileID();  
 
        // get the Blob of the cell content
        var blob = inputSheet.getRange("A1").getValue().getBlob(); 
        
       // get the URL of the cell content
        var url = inputSheet.getRange("A1").getContentUrl(); 
 
        // return the reference to the image in the cell
        return one of the above (fileID, blob, or URL) ;
    }
Rubén
  • 34,714
  • 9
  • 70
  • 166
Jerry
  • 1
  • 1
  • 1
    In your situation, I thought that this thread might be useful. https://stackoverflow.com/q/56733340 By the way, please include only one question in a question. – Tanaike Nov 29 '22 at 23:13

0 Answers0