I have just started to look at googlesheets4 having used googlesheets for a specific application.
Is the intention that googlesheets4 replace googlesheets? Or just supplement it.
In the example code below I create a new sheet using googlesheet.
The result makes it easy to get to the URL (which I pass on for users). That URL comes in 2 forms:
- Base googlesheet eg https://docs.google.com/spreadsheets/d/1Y_-I_43xGntZzc8OS_y3GBdgAxCk3WFff_bOvcQHwQU/
- Specific sheet within the googlesheet (ie workbook) eg https://docs.google.com/spreadsheets/d/1Y_-I_43xGntZzc8OS_y3GBdgAxCk3WFff_bOvcQHwQU/gviz/tq?gid=0 This is fact is a cheat as gid 0 is just the default but easy enough to get the gid of the first and subsequent sheets
Then using googlesheets4 I seem to only be able to get the URL via googledrive and then it is in a different format.
I can get the gid of the first and subsequent sheets using sheet_properties.
But nothing to quickly get URLs using googlesheets4
And how can I get sheet_write to use a googlesheet name of my choice without using drive_rename?
Have spent a while on this so hope the questions are valid
Mike
library(googledrive)
library(googlesheets)
library(googlesheets4)
# use googlesheets
googlesheetsid <- gs_new("starwars1", ws_title = "starwars1 sheet1", input = starwars,
trim = TRUE, verbose = FALSE)
print(googlesheetsid$browser_url)
print(googlesheetsid$ws %>% filter(ws_title == "starwars1 sheet1") %>% pull(visualizationApi))
# use googlesheets4
googlesheets4id <- sheet_write(starwars, ss = NULL, sheet = "starwars4 sheet1")
print(drive_link(googlesheets4id))