Templates Plugins Courses

Google Docs Embedder, can I extract the ID from the URL?


#1

Hi everyone, I’m trying the Embed Google Docs plugin and it seems to work really well to embed Sheets into our Bubble application. The problem though is how it asks for just the ID of the file and not the URL. Right now my users create a Google Sheet, then they copy the URL from the browser, and then in Bubble they create a ticket request to our quote desk team and paste in the URL in the specified field. That creates a ticket that goes to our quote desk to process it by opening the Sheet. I’d love to have the Sheet embedded right into the Bubble ticket, but the problem is how it asks just for the ID. I don’t think I can really tell my users to only copy and paste the ID part of the URL as I think they will be confused.

Is there any way to just extract the ID from the URL or any other suggestions?


#2

Hello there @lmoreau,
Thanks for reaching out,

You can do this with the help of Regex formatting of the value received by plugin element from your specified field.

You can check it on this screenshot.
Later I will provide you wich Regex formula is suitable for this case.

Thank you,
BR,
Nik.


#3

That’s great thanks so much! I’d love it if you’re able to provide that as I’m not really sure how to set it up. I appreciate the help.


#4

Hey there @lmoreau, check out this action settings,
the suitable regex for your use case is (?<=d\/)\w+ , just insert it in the field which I sent to you yesterday.

Thank you,
BR,
Nik.


#5

Great thanks so much this seems like it’s on the right track. The only issue is that it seems to be too short. For example in the one sheet I just opened, the ID is:

10tUwoUKTm8MlGQaKx8JYLtUGSw4E-DRLgerbJIRu93U

But when I use your regex above it just shortens it to 10tUwoUKTm8MlGQaKx8JYLtUGSw4E which just shows a solid white blank page on the plugin. When I change it to the full 10tUwoUKTm8MlGQaKx8JYLtUGSw4E-DRLgerbJIRu93U it shows it right away.

The only thing I should add is does it matter if I set it as a state or not? I was just setting it so that the user puts the full sheets URL in the field, and when pressing the button to save the record it then does regex on it to save it as just the ID, and then I reference that field in the plugin.


#6

Hello @lmoreau, (?&lt;=d\/)\w+\-\w+ try this one if you will not succeed, then you can check how to Regex here I hope you will succeed.

Thank you.
BR.
Nik.


#7

Thanks so much, I think we’re going to just provide a link to the file instead as now the plugin just stopped working even though I didn’t change anything since the other day. In Chrome it says:

And in Edge it says:

That’s both with me just manually typing in the ID as well which worked yesterday when I tried it so not sure what changed today. Very strange, but thanks for your help!