Developer needed for new Google Drive & Google Docs actions

@PFernandez98 A core feature is missing in Google Doc template action. We should be able to select a document as a template by its ID (or exact name). We may have to use Google Drive to find it first if necessary…but just the text box is not enough to create a template. Otherwise, we lose all of our styling and formatting, which is the point of this feature. The create a doc action was already available in AP and took variables, what I needed was the ability to recognize variables in an actual uploaded template document and fill them accordingly. That is how Zapier does it.

If it’s more complicated to do this, can we get basic rich text formatting (bold, underline, italicize) at least in the current iteration? Though, I still believe actually selecting a Google Docs document file as the template will be superior, since there are a ton of ways to organize, format, stylize it @PFernandez98

@S_M , yeah, maybe I can add a new action “Read Document” (not the same as Read File from the File Helper piece)… So you can add the result of that action to the Template field in the Create doc based on template action.

About images, i investigated this and is possible, but (as i was worried about) you need to specify width, height, and position of the image within the document. I’m gonna be thinking on how to implement this configuration dynamically.

1 Like

The “Read Document” action would be perfect.

As for the image, dimensions should just be added to the ActivePieces settings panel, no? Such that we can input it to apply for all images in the action…not sure if that’s possible or not. I don’t think it necessarily has to be dynamic, but static dimensions could work for now. Maybe pulling from an earlier step…we can just add columns to a Google Sheets.

This is done (not sent for review yet)

Now… this is what I did… It’s not exactly the same as Zapier, but I think it’s gonna work for ya.

  1. You duplicate the file using Google Drive.

  2. That is gonna return a new file ID.

  3. Then you use that new file ID to modify all the variables using the “Edit file based on template” action (previously known as Create document based on template)

I’ll be making a tutorial on how to use this, but is pretty simple. In the original document, you set variables as before [[VariableName]]. For the images tho, is a little more “complex”. You need to use the Read Document action to get the Object Id of the image in the document. This does not change when you duplicate the file, so you can use the same Id as the original template. Then, you simply set the image URL for that Id. This way, you don’t have to worry about size, or position. You simply put a placeholder image, then you get the ID and that’s it, you replace it within AP.

Example

Values (Variables)
Key - Value
BusinessName - AP
ClientName - Pablo F
etc

Images
Id - Url
kix.35dfb38fm - https://blahblah/image.png
etc

I think this is better than the HTML solution on the zapier blog you sent me.

All of this is done already, but I’ll test it a couple more times before releasing it. LMK what you think @S_M

1 Like

This sounds great! Love the placeholder idea, it’s very clever!

So for images, we would do this:

  1. Duplicate the template file
  2. Get the new doc ID
  3. Use the “Read Document” to get the object ID for the image
  4. Use your aptly named “Edit file based on template” action, where we replace the relevant variables, including an image URL for the object ID

If this is what you mean, this is a great remedy and even better than the HTML solution.

Just one question, could you replace more than one image in a document, or could you only replace one image at a time. Other variables I know we can add several.

Thanks so much bro for all your hard work, wishing you a very happy New Year!

@S_M as many as you want, same as text variables. You just need to set all the object IDs and their respective new URL. Tomorrow I’ll be sharing screenshots after the hangover goes away :sweat_smile::sweat_smile:

Thanks and Happy new year for you too man!

1 Like

@S_M as many as you want, same as text variables. You just need to set all the object IDs and their respective new URL. Tomorrow I’ll be sharing screenshots after the hangover goes away :sweat_smile::sweat_smile:

Haha! Sounds great. Take your time and enjoy the new year, you deserve it!

I’ll keep my eyes peeled for your updates.

Thanks and Happy new year for you too man!

Cheers, beers and happy new year’s! :tada: :beers:

@S_M feat: new and corrected actions for Google Drive and Docs by pfernandez98 · Pull Request #3567 · activepieces/activepieces · GitHub

1 Like

Would you be able to add a DOC to PDF action as well? Maybe a way to package @menacestudio’s solution: https://www.youtube.com/watch?v=2jqhXYyziI8 but instead of plain text, it would be for the doc, and instead of Amazon/S3, it would be Google Drive. Let me know if it’s possible and if you could add this as well. Appreciate all your hard work so far on these pieces! @PFernandez98

@S_M this adds the capability of “saving a file as pdf”, but within google drive. It returns the ID of the new PDF file. If you need to process or send the new file, then I think you can use Read File (google drive, not Read document from gdocs).

2 Likes

Jackpot! Testing it now!

@PFernandez98 Replace images and text variables work like a charm!

Waiting on the PDF approval and we should be rocking with a perfect [form → PDF signed copy] automation.

EVERYTHING WORKS PERFECT! THANKS AGAIN!

As for security, everything is only being processed by Google (and ActivePieces), right? Or does the export as PDF (or any other feature) require sending data out to another 3rd party?

@PFernandez98

Yup. Using official libraries (from Google) and the Google Drive api. So the only third party involved is ActivePieces by itself.

1 Like