Search code examples
google-apps-scriptgoogle-sheetscurlgoogle-apigoogle-oauth

How to edit/open Google Sheet using API?


I'm using API to get access_token and now I need to open Google Sheet.

I'm sending "Authorization: Bearer ya29.a0AV...." together with link: "https://docs.google.com/spreadsheets/u/0/d/[DocumentFileID]/edit" and I get HTML document back (~200kb). I'm using libcurl for that.

The problem is - missing are some css and js files and I see document just partially. Is there any way to open/edit Google Sheet using API?

I know for the option to just open https://docs.google.com/spreadsheets/u/0/d/[DocumentFileID]/edit in the new browser tab, but in that case I need to manually login to Google and that's what I try to avoid, because I want to use API to login and to open/edit a Sheet.

I also know for the option to share a document but I also try to avoid that. I'm writing application to customers who can access they own documents once they confirmed API usage.


Solution

  • I think you may have misunderstood what the google sheets api can do

    The Google Sheets API is a RESTful interface that lets you read and modify a spreadsheet's data.

    It gives you access to the data, it does not allow you to open the google sheets web application. Your going to have to code your own google sheets type app if you want users to open sheets directly.