Accessing spreadsheet in Google Script

前端 未结 2 2020
小蘑菇
小蘑菇 2021-01-11 16:19

I am writing a google script on top of a spreadsheet. I want to deploy it as a web app. It shows some values. Unfortunately, with my current code, google reminds me:

相关标签:
2条回答
  • 2021-01-11 16:45

    In standalone webapps you cannot use getActiveSpreadsheet because no one is using it actively... Use SpreadsheetApp.openById('ID') instead, you can get the ID in the url of your spreadsheet like in this example :

    https://docs.google.com/spreadsheet/ccc?key=0AnqSFd3iikE3d-------nZIV0JQQ0c1a3dWX1dQbGc#gid=0
    

    between key= and #, ie 0AnqSFd3iikE3d-------nZIV0JQQ0c1a3dWX1dQbGc

    0 讨论(0)
  • 2021-01-11 16:50

    Not need to use ID , just try this code ( change mygooglelocation with your Spreadsheet name and range of cells. Working very well for me with google maps...

      var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('mygooglelocation');
      var ss = SpreadsheetApp.getActive();
      var mylocationInfo   = ss.getRange("A2:B4").getValues();
    
    0 讨论(0)
提交回复
热议问题