Search code examples
google-sheetsgoogle-sheets-formulaaccess-control

Google Sheets revoke importrange permission


How do you revoke importrange permission? Is there an easy way to see what importrange permissions I have given as this potentially is an issue if you think your spreadsheet is not shared with anyone but you inadvertently left open some importranges.


Solution

  • If you want to revoke permissions you just need to open the original spreadsheet:

    • On the top right of the Spreadsheet document click on Share
    • A menu gets open, click on Advanced
    • Now you can see all the people you've given access to this spreadsheet.

    By removing the given rights of access to this data you'll revoke the IMPORTRANGE access rights.

    What happens know?

    This changes may take some time to propagate, so you may experience certain delay till the rights are denied, this may cause that you keep seeing the imported data for some time, but it won't last very long till the access rights are updated.

    As a tip: You can make the propagation to happen faster by modifying any cell on the original spreadsheet, once you change it, the imported ranges from the destination spreadsheet will try to get an update, as the rights were revoked, the IMPORTRANGE function will tell you that you do not have permission to access the source sheet anymore.


    More questions:

    Can we revoke importRange permission?

    When you call ImportRange for first time on a spreadsheet the question raised is:

    Has the user access to the spreadsheet is he trying to import?

    If the answer is yes, the user is requested to give ImportRange access to the required spreadsheet. Once this access is granted any editor on the destination spreadsheet can use IMPORTRANGE to pull from any part of the source spreadsheet. Documentation

    Within the same user there is no way to revoke this access other than deleting any of the two involved spreadsheet, so no, once you granted the importrange rights you can not revoke it for spreadsheets under the same owner.

    If there are two users it's enough to revoke access rights of the imported spredsheet to revoke the importRange access, as explained before.

    What happens when we add a second user to this same owner problem?

    Lets say there is another user called CodeCamper, unrelated to the previous user Yuri. CodeCamper has a spreadsheet and does an importrange to yuri's public spreadsheet ( A: the public one).

    As A is a public ( find and view ) spreadsheet CodeCamper will be able to reach any data present on that spreadsheet. If yuri's A spreadsheet has an Importrange function calling to another spreadsheet, private one, owned by yuri, called B, then CodeCamper will have access to this data thru spreadsheet A. Because CodeCamper has rights of access to yuri's A spreadsheet, because it's public. But CodeCamper doesn't have any right of access to yuri's private spreadsheet so called B.

    An thus, if yuri deletes the importRange function that retrieves data from a B private spreadsheet for A spreadsheet, CodeCamper will not be able to make an importrange anymore to the private data that was previously shown on A spreadsheet. If CodeCamper has edit access on spreadsheet A he would certainly be able to reach any data from B using A, because the file is owned by the same person and ImportRange access is been allowed previously. If you want to revoke this access you can not do it anymore.

    It works as specified on the documentation, although you may not like it, a simple solution is to use two separated users to be able to play with access rights to the files.

    How do I use securely ImportRange functions in public environments?

    Use a private user for the private spreadsheets and a public one for the public spreadsheets. With this setup you can revoke access rights from any spreadsheet anytime you want, and thus, revoke importrange access anytime you wish.