ไปยังเนื้อหาหลัก

จะรับรายชื่อชีตใน Google ชีตได้อย่างไร?

บทความนี้จะแนะนำวิธีการบางอย่างในการรับชื่อแผ่นงานปัจจุบันหรือรายชื่อแผ่นงานใน Google แผ่นงาน

รับชื่อแผ่นงานปัจจุบันในแผ่นงาน Goolge ด้วยสคริปต์

รับรายชื่อแผ่นงานใน Google ชีตพร้อมสคริปต์


รับชื่อแผ่นงานปัจจุบันในแผ่นงาน Goolge ด้วยสคริปต์

หากต้องการรับชื่อแผ่นงานปัจจุบันใน Google ชีตสคริปต์ง่ายๆต่อไปนี้สามารถช่วยคุณได้โดยไม่ต้องป้อนชื่อด้วยตนเองโปรดดำเนินการดังนี้:

1. คลิก เครื่องมือ > โปรแกรมแก้ไขสคริปต์ดูภาพหน้าจอ:

doc รับชื่อแผ่นงาน 1

2. ในหน้าต่างโปรเจ็กต์ที่เปิดอยู่ให้คัดลอกและวางโค้ดสคริปต์ด้านล่างลงในช่องว่าง รหัส หน้าต่างดูภาพหน้าจอ:

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

doc รับชื่อแผ่นงาน 2

3. จากนั้นบันทึกหน้าต่างรหัสและกลับไปที่แผ่นงานที่คุณต้องการรับชื่อจากนั้นป้อนสูตรนี้: =sheetname() ในเซลล์แล้วกด เข้าสู่ คีย์ชื่อแผ่นงานจะปรากฏขึ้นพร้อมกันดูภาพหน้าจอ:

doc รับชื่อแผ่นงาน 3


รับรายชื่อแผ่นงานใน Google ชีตพร้อมสคริปต์

หากคุณต้องการรับชื่อแผ่นงานทั้งหมดใน Google ชีตนี่คือสคริปต์อื่นที่สามารถช่วยคุณได้โปรดทำตามนี้:

1. คลิก เครื่องมือ > ต้นฉบับ ตัวแก้ไขเพื่อไปที่หน้าต่างโปรเจ็กต์จากนั้นคัดลอกและวางโค้ดสคริปต์ด้านล่างลงในช่องว่าง รหัส หน้าต่างดูภาพหน้าจอ:

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 รับชื่อแผ่นงาน 4

2. จากนั้นบันทึกหน้าต่างรหัสและกลับไปที่แผ่นงานที่คุณต้องการรับชื่อแผ่นงานทั้งหมดจากนั้นป้อนสูตรนี้: =sheetnames() ในเซลล์แล้วกด เข้าสู่ สำคัญชื่อแผ่นงานทั้งหมดใน Google ชีตจะแสดงตามภาพหน้าจอต่อไปนี้:

doc รับชื่อแผ่นงาน 5


แสดงชื่อแผ่นงานทั้งหมดและนำทางระหว่างชื่อเหล่านั้นโดยใช้ไฮเปอร์ลิงก์หรือปุ่มในสมุดงาน Excel:

กับ Kutools สำหรับ Excel's สร้างรายชื่อแผ่นงาน ยูทิลิตี้คุณสามารถแสดงชื่อเวิร์กชีตทั้งหมดในแผ่นงานใหม่ได้อย่างรวดเร็วด้วยไฮเปอร์ลิงก์หรือปุ่มมาโครจากนั้นคุณสามารถเลื่อนไปมาระหว่างชื่อเหล่านั้นได้ตามต้องการ

Kutools สำหรับ Excel: ด้วย Add-in ของ Excel ที่มีประโยชน์มากกว่า 300 รายการให้ทดลองใช้ฟรีโดยไม่มีข้อ จำกัด ใน 30 วัน ดาวน์โหลดและทดลองใช้ฟรีทันที!

สุดยอดเครื่องมือเพิ่มผลผลิตในสำนักงาน

🤖 Kutools AI ผู้ช่วย: ปฏิวัติการวิเคราะห์ข้อมูลโดยยึดตาม: การดำเนินการที่ชาญฉลาด   |  สร้างรหัส  |  สร้างสูตรที่กำหนดเอง  |  วิเคราะห์ข้อมูลและสร้างแผนภูมิ  |  เรียกใช้ฟังก์ชัน Kutools...
คุณสมบัติยอดนิยม: ค้นหา เน้น หรือระบุรายการที่ซ้ำกัน   |  ลบแถวว่าง   |  รวมคอลัมน์หรือเซลล์โดยไม่สูญเสียข้อมูล   |   รอบโดยไม่มีสูตร ...
การค้นหาขั้นสูง: VLookup หลายเกณฑ์    VLookup หลายค่า  |   VLookup ข้ามหลายแผ่น   |   การค้นหาที่ไม่ชัดเจน ....
รายการแบบเลื่อนลงขั้นสูง: สร้างรายการแบบหล่นลงอย่างรวดเร็ว   |  รายการแบบหล่นลงขึ้นอยู่กับ   |  เลือกหลายรายการแบบหล่นลง ....
ผู้จัดการคอลัมน์: เพิ่มจำนวนคอลัมน์เฉพาะ  |  ย้ายคอลัมน์  |  สลับสถานะการมองเห็นของคอลัมน์ที่ซ่อนอยู่  |  เปรียบเทียบช่วงและคอลัมน์ ...
คุณสมบัติเด่น: กริดโฟกัส   |  มุมมองการออกแบบ   |   บาร์สูตรใหญ่    สมุดงานและตัวจัดการชีต   |  ห้องสมุดทรัพยากร (ข้อความอัตโนมัติ)   |  เลือกวันที่   |  รวมแผ่นงาน   |  เข้ารหัส/ถอดรหัสเซลล์    ส่งอีเมลตามรายการ   |  ซุปเปอร์ฟิลเตอร์   |   ตัวกรองพิเศษ (กรองตัวหนา/ตัวเอียง/ขีดทับ...) ...
ชุดเครื่องมือ 15 อันดับแรก12 ข้อความ เครื่องมือ (เพิ่มข้อความ, ลบอักขระ, ... )   |   50 + แผนภูมิ ประเภท (แผนภูมิ Gantt, ... )   |   40+ ใช้งานได้จริง สูตร (คำนวณอายุตามวันเกิด, ... )   |   19 การแทรก เครื่องมือ (ใส่ QR Code, แทรกรูปภาพจากเส้นทาง, ... )   |   12 การแปลง เครื่องมือ (ตัวเลขเป็นคำ, การแปลงสกุลเงิน, ... )   |   7 ผสานและแยก เครื่องมือ (แถวรวมขั้นสูง, แยกเซลล์, ... )   |   ... และอื่น ๆ

เพิ่มพูนทักษะ Excel ของคุณด้วย Kutools สำหรับ Excel และสัมผัสประสิทธิภาพอย่างที่ไม่เคยมีมาก่อน Kutools สำหรับ Excel เสนอคุณสมบัติขั้นสูงมากกว่า 300 รายการเพื่อเพิ่มประสิทธิภาพและประหยัดเวลา  คลิกที่นี่เพื่อรับคุณสมบัติที่คุณต้องการมากที่สุด...

รายละเอียด


แท็บ Office นำอินเทอร์เฟซแบบแท็บมาที่ Office และทำให้งานของคุณง่ายขึ้นมาก

  • เปิดใช้งานการแก้ไขและอ่านแบบแท็บใน Word, Excel, PowerPoint, ผู้จัดพิมพ์, Access, Visio และโครงการ
  • เปิดและสร้างเอกสารหลายรายการในแท็บใหม่ของหน้าต่างเดียวกันแทนที่จะเป็นในหน้าต่างใหม่
  • เพิ่มประสิทธิภาพการทำงานของคุณ 50% และลดการคลิกเมาส์หลายร้อยครั้งให้คุณทุกวัน!
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