Populating Word Template with Images in Power Automate & Power Apps

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey everyone my name is Andrew Hess and about maybe two weeks ago we were working on this power automate flow that filled out a template and we were using the premium version with the word connector so we populated word using these templates here and you can see when I loaded up I have in some information you know I have the invoice number we did it based on whether this completed field was complete or not so I started getting questions about okay how to add an image so let's add an image and let's keep it simple I'm just going to keep B simple for these videos and then maybe if you want to go further Shane Young does have a base 64 video where he goes into you know coding all the base64 I have one too it's pretty old but for now let's keep it simple and create a template with an [Music] image okay so based on my last video I have a template here stored in SharePoint I'm going to open it up and I'm going I'm going to actually open it up in the app I'm going to open it up in word the client so let me open it up in the client so we have my document here and we have a logo we want to change the logo to a picture that we want so I'm going to go to the developer tab and we turned that on in the previous video and right here is picture content control I'm going to highlight that logo and I'm going to click picture content control now what's very important is your picture is to reshape reshape and resize itself based on the way it looks so if I resize it like this like a square it's going to come through as a square if I resize it you know horizontally it's going to stretch out that image for you so I'm going to try and make it Square because that's what my image is right now so we have our picture content control I'm going to go back to the developer tab I'm going to go to properties I'm going to give it a name and a title so maybe logo image and I'm going to put that in the tag too and then because it's a template I'm going to say you know you can't delete this uh content control I'm not going to let you delete it if you accidentally go into the template okay so now you can see that it's now named logo image and I'm just going to do save as I'm going to save it in the same spot okay so now I have my template it's in the same spot and now we have the logo here that is actually a picture control so we're going to fill that in now all right so let's go to Power automate and let's do this the simple way first very very very simple this is the flow that we created last time and this time I'm going to go to document here I'm going to change the file to the one with the picture so we set all this up in the previous video if you want to learn all that go to the other video I'm going to set it up with the picture content control and I'm then I'm going to hit show all right because it says seven of eight so I'm going to click show all now we have our logo image now where are we going to get this logo image let's store a picture in our SharePoint library with my picture now stored in my template Library I'm just going to pull that into Power automate right before we populate the template let's get the file so I'm just going to say get file and we're going to go through SharePoint because that's where I stored it I'm going to say get file using path I'm just going to make it super simple right now all right so where is it stored it's stored in my invoice SharePoint site the path is in my template library and it's right here a happy man with a rabbit okay and then everything else we're going to leave now we're going to go to the popul word template and we're going to populate it with the file content of the path okay and then I'm just going to hit save and that's it that's all we do to add this image we're not making a dynamic we're just making a simple logo that we're going to put in our form all right so we're going to go to our list and this is something we did last time based on the file if it's completed or not it's going to run so I'm going to create a new file all right so I filled it out so I'm going to hit save okay refresh we now have our line item in here so now let's go back to our flow and let's run it so I'm going to do so I can just manually run this so I'm going to test it manually and only the one that is not complete will run and if we'll look at our SharePoint um only the one that's not complete is going to run so if we refreshed you notice how it changed right to complete because that's part of our flow process now we're going to go to our document library and this is where our new file was created and the new file was created even though it's taking a little bit of time the image is there we'll just wait a few seconds there it is we now have our our man with a rabbit now loaded into our document that's how easy that was that is using Microsoft Word connector and it is premium so this is a premium but we're only paying for one license because we're doing it on a schedule okay so we have all that working let's go to power apps and and do some neat things there all right so I'm going to power apps I have a a blank form here and this form is going to connect to my data source let's connect to our data source so SharePoint yep and it's my invoice one invoice SharePoint and we'll start with the invoice list all right and then we'll do the data source as our invoice list okay and I'm not going to use the attachments here now what I what else I want to do is I want to connect to that Library so I'm going to also connect to SharePoint and that's going to be my template library now we could make this a different Library I think maybe we should do that we we'll call this an image Library let's create one of those in SharePoint so I'm going to go to site contents it's actually a document Library we'll call it my images and then I'll put two uh images in here all right so I have two images in a library called my images so you can see I have one image here and then I have a second image here so just some simple images they're different one is a men with a rabbit and the other is a rabbit man okay so we'll go back to power apps now I'm going to create a connection to that Library so the same SharePoint list it's going to be my images it's my document Library we're going to connect to that all right so you can see we have a new form here we can fill out some information this is the not complete complete this is the same information that we had on our list before but now what I want to do is I want another field here I want another field to pull from the list of pictures so I'm going to come to my invoice list list and it's going to be my invoice list here I'm going to create a new field and it's just going to be a text field and it's going to be my image name it's actually like the path but we're just going to say my image name okay all right so we have a new field here called my image name we'll come back to power apps and we will add that field after we refresh our data source all right so my image name all right so we have my image name now if we know the image name this will be very easy for us but maybe we don't know the the name but let's try it out first since we know one of the image names you can see one is named right here let's let's make it simple we'll just call it happy man okay so we have an image name called a happy man in I'm going to create a button and this button is going to submit so it's just a button so I'm just going to have a simple form with a big save button and this save button is just going to submit form one so let's fill one out we're going to do you know happy man we'll select some stuff in there maybe we won't populate everything not complete and this is going to be happy man. jpeg so we know the name of the file right so if we go to look at the file right here it's happy man. jpeg we just know that we're going to test something out I'm going to save it's going to write to SharePoint so here's my new one happy man with information in there and the my image name is now happy man. jpeg okay so now let's go back to Power automate and right here we did the get file content using path so we found it at this path before we put it in our template library but but we have a new library now and it's called My images and this is where we stored the happy man. JPEG and so when I click on it you can see it's my imagesapp man. jpeg so I'm going to erase this and I'm going to replace it with that column that we we inserted so this is going to be my images my image name and we can see that we have my images SL myimage name and in the populate we're going to make sure that it is getting the right file content so it's getting right here from the file content using path I'm going to hit save and test and this should be able to pull in the path so now we'll test manually trigger save and run so we're testing we're running we're running we have that new line item from power apps so let's go to our documents now and we can see we have a new one here happyman dods we open it up we can see it did populate with that image and so we could do it with the other image too so let's go to our other images let's change the the name to Shorter all right so we have happy man and rabbit man so now let's pull in that information the name in power apps so in power apps now we're going to do a lookup here and instead of it being a data card I'm going to delete it I'm going to insert a drop down or maybe even let's do a combo box I'm going to do a combo box so the combo box is going to come from my images I'm going to come over here to Fields edit add field I'm going to find file name with extension and I'm going to remove title so remove title I'm going to hit play to check it out so we can see I have happy man and rabbit man so it's pulling in that extension isn't that amazing okay so now let's fix these red X's this red X is just a y value it's saying hey set that up I'm just going to get rid of that we don't need to set up the yvalue I'm fine the update property we do need to update so instead of data card .value we're going to call it combo box canvas one dot selected dot file name with extension so now we're literally pulling in the file name with an extension so let's create a new item so my rabbit man logo we'll F fill all this in let me fill it in real quick I'm going to select the rabbit man I'm going to hit save so now we've written to SharePoint it's pulling in the file name with extension right so we have a new line item in SharePoint now we're going to run our power automate flow on everything that's not complete on a Monday so we're going to go to Power automate and we're going to test it test manual test and we're going to run and this is keeping it simple we're not doing all that you know base 64 we're not converting anything we're literally getting the file name with extension and just adding our path so when we go to SharePoint and we go to our documents and now we have my rabbit man logo and we open that file we can see we now have the Rabbit Man logo in there with all that information and to me that is keeping it simple use that file path with use that file content with path now watch this let's keep it simple again again we have our card I'm going to insert an image insert the image the image is going to be related to the dropdown so the image property up here I'm going to say combo box canvas one right that's the name of our combo box do selected and where are we going to get it from we're going to get it from the link of the image so let's see link to item so now we've populated an image also so we can select rabbit man it's going to populate Lighthouse it's going to populate so no matter what we put in our SharePoint we can get a image of it also and it's going to write that file now to me that's keeping it simple now we can simply create a template have it right with through One Premium license and write those images through SharePoint using the file extension name so if you like this content if this was helpful please like And subscribe my name is Andrew hes if you have more questions this questions came up through my email and they wanted to do Bas 64 and everything I want to keep it simple I'm going to keep it simple I'm going to use that file content with path pull that into Power automate use the file extension here and let me view the image thank you I'll see you next time
Info
Channel: Andrew Hess - MySPQuestions
Views: 4,755
Rating: undefined out of 5
Keywords: images in documents, document templates, populate a document, images with documents, power apps, power automate, power platform, image content control, file content power automate, file content with path power automate, how to populate documents with images, microsoft, document tutorial, how to create document templates, leonardo.ai, ai images
Id: dSvFe8UmPmY
Channel Id: undefined
Length: 14min 23sec (863 seconds)
Published: Mon Dec 18 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.