Is it possible to append rows to an existing Google Sheet using drive.file scope?
The https://www.googleapis.com/auth/drive.file scope is defined as
Per-file access to files created or opened by the app
in the Sheets docs and
Per-file access to files created or opened by the app. File authorization is granted on a per-user basis and is revoked when the user deauthorizes the app
in the Drive docs.
What does Google mean by "opened" by the app? Open isn't a method in the API.
I've built an app that uses the drive.file scope, and the app authenticates and receives tokens just fine. When I try to append a row to an existing Sheet, the API response is a 404.
If I authenticate the same app using the more broad scope https://www.googleapis.com/auth/spreadsheets, the app has no trouble appending rows to the same Sheet. I don't want to use a more broad scope that requires app verification because the app is an OAuth based plugin, a type of app Google says should not require Sensitive or Restricted scopes or verification. My app also fits the criteria Google recommends for the drive.file scope here.
I have found all these questions that are near duplicates and have no definitive answers:
- Request specific file permissions with Google Sheets / Google Drive API
- AuthToken for drive.file scope returning 404
- Getting Google file picker to work with drive.file scope
- How to use the scope https://www.googleapis.com/auth/drive.file correctly
- Is there anyway to get private file of user with drive.file scope
- Is the https://www.googleapis.com/auth/drive.file enough to create and update files or is the scope /drive needed?
drive.filegives you access rights to the file you created with the app, not too any other files of the user. There is a good reason for the fact that you need to verify your app. After all the user should be aware that you have access to all of his spreadsheets.Unverified app screenwhich will warn him about potential dangers involved with certain scopes. Because without verification, there is no control about what your code is doing with the access to user's data.