rg89
rg89

Reputation: 371

Append rows to a Google Sheet using drive.file scope

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:

  1. Request specific file permissions with Google Sheets / Google Drive API
  2. AuthToken for drive.file scope returning 404
  3. Getting Google file picker to work with drive.file scope
  4. How to use the scope https://www.googleapis.com/auth/drive.file correctly
  5. Is there anyway to get private file of user with drive.file scope
  6. Is the https://www.googleapis.com/auth/drive.file enough to create and update files or is the scope /drive needed?

Upvotes: 1

Views: 380

Answers (1)

rg89
rg89

Reputation: 371

I concluded no, it is not possible. I designed my app to have a "Create Sheet" button as a workaround, and the drive.file scope works fine to append rows and make other edits to a Sheet that my app creates.

Upvotes: 1

Related Questions