question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Change permissions of a google sheet / newly created sheet.

See original GitHub issue

Permissions are scope of google drive in googleapis and not sheets but it would be cool to have that integrated with this implementation of spreadsheet.

My usecase : I would like to make a sheet public and get the new url.

This is how I do it right now.

let { google } = require('googleapis');
var creds = require('./google-creds.json');
(async function main() {
  const jwtClient = new google.auth.JWT(
    creds.client_email,
    null,
    creds.private_key,
    ['https://www.googleapis.com/auth/drive'],
    null
  );
  
  drive = google.drive({ version: "v3", auth: jwtClient });
   const res = await drive.permissions.create({
    resource: {
      type: "anyone",
      role: "writer"  // Please set the email address you want to give the permission.
    },
    fileId: doc.spreadsheetId,
    fields: "id",
  });
})();

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:4
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
theoephraimcommented, Dec 10, 2022

Not currently. You will have to make the request to the drive API yourself. Either via an http request, or using google’s official npm module.

I just pushed up my wip on the rewrite which has this functionality. Look here

0reactions
doverradiocommented, Dec 10, 2022

then make a drive API request to update the permissions

Yes, this must be the solution. Can your library handle this part? If no, what would you suggest? It already created one spreadsheet so I would need to successfully change permissions on that, then I am finished.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Google Sheets Permissions: Edit, Comment, View | Layer Blog
Change Sheets permissions for an entire spreadsheet · 1. Click on the “Share” button in the top-right corner. · 2. To the right...
Read more >
How to Set Editing Permissions in Google Sheets - Technipages
You can do this by going to Data > Protected Sheets and Ranges > Sheet > Set Permissions, and in the following window,...
Read more >
Google Sheets permissions: Different levels and use
Google Sheets offers four different permission levels; ownership, edit, comment, and view. There are many different situations in which you would benefit from ......
Read more >
Protect, hide, and edit sheets - Google Docs Editors Help
Open a spreadsheet in Google Sheets. · Click Data and then Protected sheets and ranges. · Click Add a sheet or range or...
Read more >
Sharing and permissions in Google Sheets - Tiller Help Center
If you do not have edit access to a spreadsheet that is shared with you and you need to add data or edit...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found