Search code examples
phpgoogle-sheetsgoogle-apigoogle-api-client

Google sheet API - PHP - Create a sheet


I have used google sheet API in php for create a new sheet , it is creating new sheet but i want to be it publicly editable but it is only accessed by particular gmail account only. which have owner,

So it is possible that to create a google sheet using API in php and allow it publicly editable?

Thank you in advance.


Solution

  • After creating the spreadsheet with the Sheets API, you need to update the permissions with the Drive API

    For this:

    • Retrieve the spreadsheet id after creation
    • Use this id as the fileId parameter for Permissions: create
    • Specify in the Request body
    {
      "role": "writer",
      "type": "anyone"
    }