Preskoči na glavno vsebino

Kako dobiti seznam imen listov v Googlovih listih?

V tem članku bom predstavil nekaj metod za pridobitev imena trenutnega imena listov ali seznama imen listov v Googlovih listih.

Pridobite trenutno ime lista v Goolge listih s skriptom

Pridobite seznam imen listov v Googlovih listih s skriptom


Pridobite trenutno ime lista v Goolge listih s skriptom

Če želite dobiti trenutno ime lista v Googlovih listih, vam lahko pomaga naslednji preprost skript, ne da bi ga ročno vnesli, tako:

1. Kliknite Orodja > Urejevalnik skriptov, glej posnetek zaslona:

doc dobi ime lista 1

2. V odprto okno projekta kopirajte in prilepite spodnjo kodo skripta v prazno Koda okno, glej posnetek zaslona:

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

doc dobi ime lista 2

3. Nato shranite okno kode in se vrnite na list, za katerega želite dobiti njegovo ime, nato vnesite to formulo: =sheetname() v celici in pritisnite Vnesite tipka, bo ime lista prikazano naenkrat, glejte posnetek zaslona:

doc dobi ime lista 3


Pridobite seznam imen listov v Googlovih listih s skriptom

Če želite dobiti vsa imena listov v Googlovih listih, je tukaj še en skript, ki vam lahko stori uslugo, storite tako:

1. Kliknite Orodja > Script urejevalnika, da odprete okno projekta, nato pa kopirajte in prilepite spodnjo kodo skripta v prazno Koda okno, glej posnetek zaslona:

function sheetnames() { 
  var out = new Array()
  var sheets = SpreadsheetApp.getActiveSpreadsheet().getSheets();
  for (var i=0 ; i<sheets.length ; i++) out.push( [ sheets[i].getName() ] )
  return out  
}

doc dobi ime lista 4

2. Nato shranite okno s kodo in se vrnite na list, za katerega želite dobiti vsa imena listov, nato vnesite to formulo: =sheetnames() v celici in pritisnite Vnesite ključa, bodo vsa imena listov v Googlovih listih navedena na spodnji sliki zaslona:

doc dobi ime lista 5


Seznam vseh imen listov in krmarjenje med njimi s pomočjo hiperpovezav ali gumbov v Excelovem delovnem zvezku:

z Kutools za Excel's Ustvari seznam imen listov Pripomoček lahko na hitro poiščete vsa imena delovnih listov na novem listu s hiperpovezavami ali gumbi makra, nato pa lahko med njimi krmarite po svojih željah.

Kutools za Excel: z več kot 300 priročnimi dodatki za Excel, brezplačno preizkusite brez omejitev v 30 dneh. Prenesite in brezplačno preskusite zdaj!

Najboljša pisarniška orodja za produktivnost

🤖 Kutools AI Aide: Revolucionirajte analizo podatkov na podlagi: Inteligentna izvedba   |  Ustvari kodo  |  Ustvarite formule po meri  |  Analizirajte podatke in ustvarite grafikone  |  Prikličite funkcije Kutools...
Priljubljene funkcije: Poiščite, označite ali identificirajte dvojnike   |  Izbriši prazne vrstice   |  Združite stolpce ali celice brez izgube podatkov   |   Krog brez formule ...
Super iskanje: Več kriterijev VLookup    Multiple Value VLookup  |   VLookup na več listih   |   Nejasno iskanje ....
Napredni spustni seznam: Hitro ustvarite spustni seznam   |  Odvisni spustni seznam   |  Večkrat izberite spustni seznam ....
Upravitelj stolpcev: Dodajte določeno število stolpcev  |  Premakni stolpce  |  Preklop stanja vidnosti skritih stolpcev  |  Primerjaj obsege in stolpce ...
Predstavljene funkcije: Mrežni fokus   |  Pogled oblikovanja   |   Velika vrstica formule    Upravitelj delovnih zvezkov in listov   |  Knjižnica virov (Samodejno besedilo)   |  Izbirnik datuma   |  Združite delovne liste   |  Šifriranje/dešifriranje celic    Pošljite e-pošto po seznamu   |  Super filter   |   Poseben filter (filter krepko/ležeče/prečrtano ...) ...
15 najboljših kompletov orodij12 Besedilo Orodja (dodajanje besedila, Odstrani znake,...)   |   50 + Graf Vrste (Gantt Chart,...)   |   40+ Praktično Formule (Izračunajte starost glede na rojstni dan,...)   |   19 vstavljanje Orodja (Vstavite kodo QR, Vstavi sliko s poti,...)   |   12 Pretvorba Orodja (Številke v besede, Pretvorba valut,...)   |   7 Spoji in razdeli Orodja (Napredne kombinirane vrstice, Razdeljene celice,...)   |   ... in več

Napolnite svoje Excelove spretnosti s Kutools za Excel in izkusite učinkovitost kot še nikoli prej. Kutools za Excel ponuja več kot 300 naprednih funkcij za povečanje produktivnosti in prihranek časa.  Kliknite tukaj, če želite pridobiti funkcijo, ki jo najbolj potrebujete...

Opis


Kartica Office prinaša vmesnik z zavihki v Office in poenostavi vaše delo

  • Omogočite urejanje in branje z zavihki v Wordu, Excelu, PowerPointu, Publisher, Access, Visio in Project.
  • Odprite in ustvarite več dokumentov v novih zavihkih istega okna in ne v novih oknih.
  • Poveča vašo produktivnost za 50%in vsak dan zmanjša na stotine klikov miške za vas!
Comments (21)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Thanks :)))
This comment was minimized by the moderator on the site
This script in Google Sheets works great! However, sheetnames() doesn't seem to update when new sheets are added or sheets are renamed. Is there a way to make it refresh?
This comment was minimized by the moderator on the site
why is it not working for me?i have copied the scripts and they seem so run with no errors, but when i go to google sheets, it dosent show the function "sheetsname"
This comment was minimized by the moderator on the site
Save the script and run
This comment was minimized by the moderator on the site
How to export all sheet names in open excel file to Google Sheet? Thank you
This comment was minimized by the moderator on the site
How to export all sheet names in open excel file to Google Sheet?
This comment was minimized by the moderator on the site
works for me! Thanks!!!
This comment was minimized by the moderator on the site
TypeError: Cannot read property 'getSheets' of null (riadok 3, súbor Kód)
This comment was minimized by the moderator on the site
Sorry.I did something wrong.It is already working fine.
This comment was minimized by the moderator on the site
Hey, may i know what is your mistake? i have the same error
This comment was minimized by the moderator on the site
Hi.
Of course You can.
I created a script using the Google Script Manager (script.google.com) and thought it would work automatically on all sheets in my google drive, but that wasn't true.Probably a script created throught Google Script Manager, not throught sheet, is not linked to a sheet.I had to create a script via menu in the top bar in the open Google Sheets "Tools / Script Editor" and the function I created works only in that given sheet.Please write if this solved your problem.
:)
This comment was minimized by the moderator on the site
Hello,


Ive registered an account just to say, ive found a way to automatically update this function, its a cheat really.



In cell C!, ive put a checkbox.

At my header of sheet names, I put this code.



=if(C1=true,sheetnames(),)


Then, when we edit a tab name or create a new one, we uncheck the box and check it again and it is done, not perfect, but better than deleting the cell and re-pasting.


Thank you


Charlie.

EDIT , i tried inserting picture, but it seems to disappear.
This comment was minimized by the moderator on the site
For everyone wondering how to get the sheet index to update automatically, you need to be able to call the function and then Re-enter the formula into where you want the index to be kept.
In my case I have a dedicated Index Sheet, and after most of my functions I call 'sheetnames()' and then just Re-enter the formula in the specific cell.
This comment was minimized by the moderator on the site
sheetnames();
ss.getSheetByName('Index').getRange('A1').setFormula('=sheetnames()');
This comment was minimized by the moderator on the site
What's ss?
This comment was minimized by the moderator on the site
Hi Carlos,

var ss = SpreadsheetApp.getActive();

Hope that helps.
This comment was minimized by the moderator on the site
me pueden ayudar para crear una macro en GAS que abra una nueva hoja (sheet), luego la renombre y luego se puede escribir dentro de esta hoja nueva?
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations