Web Applications Stack Exchange is a question and answer site for power users of web applications. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there any way to display a sheet name as the result of a function in a google doc spreadsheet (exactly like this question, except in gspread)?

share|improve this question

migrated from superuser.com Jun 6 '11 at 15:58

This question came from our site for computer enthusiasts and power users.

up vote 9 down vote accepted

Someone has written a script to do this. It is available in Tools > Script gallery.... Search for sheet name and install the script, then use it with =getCurrentSheetName()

share|improve this answer
9  
How to access this script in the "new" Google Sheets (which now uses an add-on store)? – Benjamin Mar 29 '14 at 6:13
3  
This no longer works. Use the answer from @user93341. I went through the entire process to publish his function to the the Add-On Store and in the last step they wanted $5 to verify my account and I would be limited to publishing 20 items. Le sigh. – Bruno Bronosky Aug 19 '15 at 18:24

Go to ToolsScript Editor and add this code:

function sheetName() {
  return SpreadsheetApp.getActiveSpreadsheet().getActiveSheet().getName();
}

In a cell where you want the sheet name add:

=sheetName()

There was an issue with accessing sheet names via API functions shown below—where it only returned the first sheet name. This was fixed in March 2015.

share|improve this answer
    
Could you expand upon your answer for those of us that are not familiar with the script tool? – codingbadger Apr 1 '15 at 7:09
1  
@Barry 1) Select Tools->Script Editor 2) In the resulting text file, add this function at the end 3) Click save 4) Now you can use this function in your sheet. – gamliela May 13 '15 at 12:43
    
While this function works fine, it doesn't update when sheet name changes, so it's not actually useful. – jesjimher May 4 at 7:47

Here is a Custom Function code snippet to get a spreadsheet name by it's Identifier.

function GetSpreadsheetNameById(id) {
  var ss = SpreadsheetApp.openById(id);
  return ss.getName();
}

In a cell, pass a sheet Identifier (look in the spreadsheet URL for the identfier).

=GetSpreadsheetNameById('49nvkwOE-203nXDLGGJtg0htFKK020dsd939AAPZU')
share|improve this answer
1  
This is just a slight change to @user93341 answer above. – JamesThomasMoon1979 Feb 20 '15 at 22:34

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.