Accessing the "name" of a sheet in a workbook

35 views
Skip to first unread message

Jack Royal-Gordon

unread,
Dec 28, 2016, 1:17:08 PM12/28/16
to spreadsheet
How can I get the name of a specific worksheet (e.g. workbook.sheet(0).name)? I am trying to distinguish different spreadsheet layouts, and the name of the sheet is relevant.

Ahmed Bahaggag

unread,
Feb 23, 2017, 5:27:48 AM2/23/17
to spreadsheet
Hello Jack

I guess you can try this:

# this will return all work sheets for the workbook
workbook.worksheets

# you can find a work sheet by name as the following
mysheet = workbook.worksheets.find { |sheet| sheet.name == "sheet name" }

Hope that help

Regards
Reply all
Reply to author
Forward
0 new messages