Digital Exchange

 View Only
last person joined: 14 hours ago 

This community is a place to discuss Blue Prism DX assets and development.

 [Solved] GDrive API - Create Excel File not working

Jump to Best Answer
Miguel Carrillo's profile image
Miguel Carrillo posted 05-24-2022 19:02
Solution: .zip file that contains a Sample process of how to use those actions. Download Zip
----------------------------------------------------------------------------------------------------------------------------------

Hello everyone.

I am trying to upload a file to Google Drive using the GDrive release host in DX portal.
https://digitalexchange.blueprism.com/dx/entry/9648/solution/drive-api-v3-2

I made the setup process, and right now I'm able to upload files, the problem comes when I tried to upload Excel (.xlsx) files. The file is uploaded and it's shown in the Google Drive folder. But the content of the file is wrong. When I tried to open it, shows incorrect content. (It appears like a base64 string).
I already tried with different kinks of MimeType but did not work.
application/vnd.google-apps.spreadsheet
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet

I already tried modifying the Request using multipart/form but did not work.
I tried to set up the parameter content-transfer-encoding: base64  but did not work.
Thanks in advance.


 
Eric Wilson's profile image
Eric Wilson Best Answer
Hi @Miguel Carrillo,

The Community admins have identified an issue with the attach feature. In the meantime, I was able to upload the VBO directly to the DX Community library. You can find it here.

Cheers,
Eric​
Eric Wilson's profile image
Eric Wilson
Hi @Miguel Carrillo,

Apologies for the delayed response to your question. Google APIs can be difficult to work with even when using the connectors from the DX. Google Drive is a perfect example. In order to make it a bit easier, we've been working on a VBO that implements some of the more complex endpoints of their REST API in a more user friendly fashion. I was going to attach a copy of it here, but for some reason the Add Attachment option doesn't seem to be working.

Let me check with the support folks to see what's going on with this site. If I can get the attachment uploaded shortly I will. Otherwise, we should have the VBO posted to the Digital Exchange next week.

Cheers,
Miguel Carrillo's profile image
Miguel Carrillo
Hi @Eric Wilson

​Thank you for sharing the VBO.
I have already imported it to my project.

Could you help me with was is the best approach in order to get the required Token as Text?

I noticed that I need Access Token as an input for the VBO Actions.
I am not sure how to get that Access Token as a Text. In my previous approach, The Web API Service had a configuration tab, where you could set up the credentials.


I also reviewed the VBO Webservices-OAuth2.0.
But I'm not sure about the parameters that I need to fill in order to retrieve the token.

Thanks in advance.
Eric Wilson's profile image
Eric Wilson
@Miguel Carrillo,

You can use ​the connector linked below to request a token from Google.

https://digitalexchange.blueprism.com/dx/entry/9648/solution/google-cloud---authentication

Pay attention to the user guide as there’s a dependent DLL that you need to place in the Blue Prism directory.

Cheers,
Eric
Miguel Carrillo's profile image
Miguel Carrillo
Hi @Eric Wilson

It works perfectly.
I modified the VBO adding the Update File Action as well. 
I also published a .zip file that contains a Sample process of how to use those actions.
Download Zip

I only have one doubt remaining. Is there a possible way, to use a regular Google account and retrieve the token, instead of using a Google service account?

Thanks for all your help.
Best regards.
Eric Wilson's profile image
Eric Wilson
@Miguel Carrillo,

I've tinkered with regular user accounts in the past, but they've been problematic as you typically have to deal with an approval flow via the browser. A digital worker should be able to handle that through UI automation, but what I've found is that some of the Google elements can't be properly identified. Kind of frustrating.

It's been a while since the last time I tested it, so I'll see if I can set aside some time to revisit in the coming weeks to see if anything has improved.

Cheers,
Eric  ​
Miguel Carrillo's profile image
Miguel Carrillo
Hi @Eric Wilson

It would be awesome if we could find a possible way to use regular accounts. If you still have some of the attempts you made in the past, I can use them as a base for further research on my own. Let me know if I can help you in any way.
I want to thank you again for all your time and support.

Best regards.​
Eric Wilson's profile image
Eric Wilson
@Miguel Carrillo,

I've spent some time looking at the use case for an OAuth user token. I believe I have a solution, and I will be posting a beta version of the VBO to the DX in the next couple of days. Once it's published, I'll let you know.

Cheers,
Eric​
Eric Wilson's profile image
Eric Wilson
@Miguel Carrillo,

The beta version of the VBO is available on the DX now. Since this is a beta you can't directly download it. First yo have to request access to it from the asset page. Once we see your request, we'll approve it and then you'll have access to download the asset.

https://digitalexchange.blueprism.com/dx/entry/9648/solution/google-cloud---authentication-2

Cheers,
Eric