Programmatically accessing a tab by Google Sheet tab index, and links?

249 views
Skip to first unread message

Chris Larkin

unread,
Oct 22, 2019, 1:15:48 PM10/22/19
to Google Apps Script Community
Hi -

I've worked out my previous issue making a duplicate of a template tab and inserting it in the document where I want it to appear; however, I do not know how to generate a link to that (new) tab to share via email. 

  1. Is there a way to get the URL of the active tab? 
  2. Is there a more generic way to build links to a Google Sheet, where I could use a specific document link + some parameter that would open to a specific tab by the tab's index?
Thanks in advance for your help!
Christopher

County Vape

unread,
Oct 22, 2019, 1:33:25 PM10/22/19
to google-apps-sc...@googlegroups.com
Im pretty sure you can get cell specific Urls now. I haven't tried in apps script though. If you right click on the desired cell you can "get link to this range" maybe that will get you what you need?

--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/9b73e745-3243-4f16-99fe-35bcb093b0bb%40googlegroups.com.


--

Sincerely, Luke Marshall


Luke Marshall

instagram_32.pngfacebook_32.pngtwitter_32.pngHome 32 .png

Cell: 647-525-664

Work: 519-787-1264

Lu...@countyvape.com




All communications unless specifically stated otherwise are private and Confidential. If you think you have received an email in error please disregard it's contents and delete it immediately.

Chris Larkin

unread,
Oct 22, 2019, 1:49:05 PM10/22/19
to Google Apps Script Community
Yes you can get cell links, although I do not need that. What I need is a programmatically accessed URL for a tab, and, if possible, how to generate a URL to access a given tab by index, not name or unique identifier. 

Thanks for the input Luke ;-) 

On Tuesday, October 22, 2019 at 12:33:25 PM UTC-5, Luke Marshall wrote:
Im pretty sure you can get cell specific Urls now. I haven't tried in apps script though. If you right click on the desired cell you can "get link to this range" maybe that will get you what you need?

On Tue, Oct 22, 2019 at 1:15 PM Chris Larkin <ch...@arcalea.com> wrote:
Hi -

I've worked out my previous issue making a duplicate of a template tab and inserting it in the document where I want it to appear; however, I do not know how to generate a link to that (new) tab to share via email. 

  1. Is there a way to get the URL of the active tab? 
  2. Is there a more generic way to build links to a Google Sheet, where I could use a specific document link + some parameter that would open to a specific tab by the tab's index?
Thanks in advance for your help!
Christopher

--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-community+unsub...@googlegroups.com.

Alan Wells

unread,
Oct 22, 2019, 1:57:12 PM10/22/19
to Google Apps Script Community
You can add:

#gid=Sheet_Tab_ID_Number_Here

To the end of the url.

If you just inserted a tab with code, you can get the new sheet tab ID with:

//ss = spreadsheet
var shId = ss.insertSheet(shTabName).getSheetId();

var ssUrl = SpreadsheetApp.getActiveSpreadsheet().getUrl();
ssUrl = ssUrl + '#gid=' + shId;

Chris Larkin wrote:
Hi -
Reply all
Reply to author
Forward
0 new messages