简体   繁体   中英

How to publish sheet (not spreadsheet) via Google Apps Script

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.

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

You just can hide the other sheets in the spreadsheet

So if you publish only your desired one is shown.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM