Syntax help for googledrive dribble

Hi Team,

I've worked out how to successfully upload a file into Google Drive using googledrive.

drive_upload(media = input$file$datapath, name = new_name, path = drive_id)

I've stored the returned value in upload_details and now I'd like to access the URL for that uploaded file.

upload_details <- drive_upload(media = input$file$datapath, name = new_name, path = drive_id)
# A dribble: 1 × 3
    name         id                     drive_resource 
    <chr>        <drv_id>               <list>
1   new.txt      xxxxxxx                <named list [39]>

When I look into drive_resource I see what I want, but it has a strange format:

upload_details$drive_resource
...
[[1]]$webContentLink
[1] "https://drive.google.com/uc?id=xxxxxxx&export=download"
...

and this doesn't work:

upload_details$drive_resource$webContentLink

Eventually I find that this does work:

> upload_details$drive_resource[[1]]$webContentLink
[1] "https://drive.google.com/uc?id=xxxxxxx&export=download"

That syntax doesn't naturally translate for me as a new R practitioner. Is there a different syntax I can use?

Also, how can I get that URL as a raw string rather than with the leading [1]? I need something that I can pass upstream to another API.

Thanks.

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.