rexcelgoogle-sheetsgooglesheets4

Print sheet names from googlesheets


Brand new to googlesheets4. I have an Excel workbook here:

library(googlesheets4)
read_sheet("https://docs.google.com/spreadsheets/d/1RBtzn3_FXxz1YD4McQJ29pU-UUodKMVM182-Bmx2Xas/edit?usp=sharing")

This workbook has 3 sheets. My question is: what googlesheets4 function do I use to see the names of the sheets within the book? I was reading about gs4_example but couldn't figure out how to use it. I am basically trying to use something similar to this:

gs4_get(gs4_example("mini-gap"))

Solution

  • You can use the sheet_names function.

    sheet_names("https://docs.google.com/spreadsheets/d/1RBtzn3_FXxz1YD4McQJ29pU-UUodKMVM182-Bmx2Xas/edit?usp=sharing")
    # [1] "RBsalmon"    "RBtrout"     "RBsteelhead"
    

    I found this quickly by opening the index of all googlesheets4 functions in my RStudio help window and then using the find feature on the word "name".