/docs/community?hl=en
/docs/community?hl=en
1/2/10
Original Poster
cerkon

How do I reference the sheet name of a spreadsheet in a cell so that it updates automatically?

Windows Vista, 64 bit Operating System.  I want to show the sheetname of a spreadsheet in CellA1, automatically, so when I change the sheet name it will also change in CellA1.



Community content may not be verified or up-to-date. Learn more.
All Replies (6)
MikeUmami
1/29/10
MikeUmami
I also would like to know the answer to this question. 
ahab
1/29/10
ahab
Not supported... :(
 
:'(
thespoonman
5/7/10
thespoonman
Here's how to work it...you will need to create a script.

Tools:Scripts:Script Editor

Enter this code:

function SName(input) {
var output = 0;
var doc = SpreadsheetApp.getActiveSpreadsheet();
var sheet = doc.getSheets()[(input-1)];
output = (sheet.getName());
return output;
}

Save the script then run the script.

Now simply enter, =Sname(*sheet number from the left tab, the first sheet is 1*), and it will pull up the sheet name.
ahab
5/7/10
ahab
thespoonman,
Your function like the much similar GetSheetName custom function *) has a big problem: it won't update when the sheet name is changed... 

*) 
function GetSheetName({
  return SpreadsheetApp.getActiveSheet().getName()
}

krakanut
7/10/10
krakanut
I have found that if you change a sheet(s) name(s) you simply go to script editor, re-save script and close back out (no changes at all) and all uses of the sname() do update to proper revised sheet name.
ahab
7/10/10
ahab
"you simply go to script editor, re-save script and close back out (no changes at all)"
That's fine for a developer but hardly for the average user I'm afraid.
Were these replies helpful?
How can we improve them?
 
This question is locked and replying has been disabled. Still have questions? Ask the Help Community.

Badges

Some community members might have badges that indicate their identity or level of participation in a community.

 
Expert - Google Employee — Googler guides and community managers
 
Expert - Community Specialist — Google partners who share their expertise
 
Expert - Gold — Trusted members who are knowledgeable and active contributors
 
Expert - Platinum — Seasoned members who contribute beyond providing help through mentoring, creating content, and more
 
Expert - Alumni — Past members who are no longer active, but were previously recognized for their helpfulness
 
Expert - Silver — New members who are developing their product knowledge
Community content may not be verified or up-to-date. Learn more.

Levels

Member levels indicate a user's level of participation in a forum. The greater the participation, the higher the level. Everyone starts at level 1 and can rise to level 10. These activities can increase your level in a forum:

  • Post an answer.
  • Having your answer selected as the best answer.
  • Having your post rated as helpful.
  • Vote up a post.
  • Correctly mark a topic or post as abuse.

Having a post marked and removed as abuse will slow a user's advance in levels.

View profile in forum?

To view this member's profile, you need to leave the current Help page.

Report abuse in forum?

This comment originated in the Google Product Forum. To report abuse, you need to leave the current Help page.

Reply in forum?

This comment originated in the Google Product Forum. To reply, you need to leave the current Help page.