2

I'm trying to publish a sheet using Google Apps script and get its (published) URL.

The only solution I've found is this thread, however the proposed script publishes entire spreadsheet, not as suggested in the question, particular sheet. I'm not sure what syntax to use as fileId in

Drive.Revisions.update(resource, fileId, revisionId);

in order to publish only active sheet, not entire spreadsheet.

TheMaster
  • 45,448
  • 6
  • 62
  • 85
Admin TTS
  • 21
  • 1

2 Answers2

0

Unfortunately it is not possible to publish a single sheet with Google Apps Script/Drive API. This is a product limitation for Drive API, this request can be promoted for future development through here.

Also, you can't retrieve the URL from the published spreadsheet with the API but when the spreadsheet is published to the web, the URL follows a specific pattern, you can refer to this answer for more details.

The pattern to follow for a single sheet would be:

https://docs.google.com/spreadsheets/d/e/2PACX-SPREADSHEETID/pubhtml?gid=IDOFTHESHEET&single=true
Lorena Gomez
  • 1,946
  • 2
  • 4
  • 11
  • Thanks guys. That's a bit of a boomer but I'm glad I've posed this question as opposed to continue wasting my time on getting the answer :) Thank you. – Admin TTS Nov 07 '22 at 09:57
  • You're welcome @AdminTTS, if this answers your question, please click the accept button on the left (check icon). By doing so, other people in the community, who may have the same concern as you, will know that theirs can be resolved. If the accept button is unavailable to you, feel free to tell me. [How to accept answer](https://stackoverflow.com/help/accepted-answer) – Lorena Gomez Nov 07 '22 at 13:27
0

You just can hide the other sheets in the spreadsheet

So if you publish only your desired one is shown.

Alex
  • 26
  • 6