Trying to read cell 1,1 in spreadsheet using Google Script API

后端 未结 1 460
北海茫月
北海茫月 2020-12-16 10:34

I\'m a mildly experienced programmer ... I have an OK understanding of OOP concepts, I\'ve been using PHP and MySQL lately. I\'ve started to dabble

相关标签:
1条回答
  • 2020-12-16 10:46

    You have to first obtain the Range object. Also, getCell() will not return the value of the cell but instead will return a Range object of the cell. So, use something on the lines of

    function email() {
    
    // Opens SS by its ID
    
    var ss = SpreadsheetApp.openById("0AgJjDgtUl5KddE5rR01NSFcxYTRnUHBCQ0stTXNMenc");
    
    // Get the name of this SS
    
    var name = ss.getName();  // Not necessary 
    
    // Read cell 1,1 * Line below does't work *
    
    // var data = Range.getCell(0, 0);
    var sheet = ss.getSheetByName('Sheet1'); // or whatever is the name of the sheet 
    var range = sheet.getRange(1,1); 
    var data = range.getValue();
    
    }
    

    The hierarchy is Spreadsheet --> Sheet --> Range --> Cell.

    0 讨论(0)
提交回复
热议问题