Power Automate - Post Attachments to Row/Sheet
Hello everyone!
I spent WAY to long looking for this answer so I thought I would share it with the Community in hopes of helping someone else.
Problem: Adding attachments to rows/sheet is not possible through the standard SmartSheet Connector
Solution: This can only be done by creating a Custom Connector. It CANNOT be done through the HTTP request. As of writing this, here is the relevant information. On the
General tab
Scheme: "HTTPS"
Host: "api.smartsheet.com"
Base: "/2.0/"
Security
Authentication Method: API Key
Parameter Location: Header
The rest of the info is up to you.
Definition
Url: https://api.smartsheet.com/2.0/sheets/{sheetId}
Headers: Content-Type and Content-Disposition
Body: This must be edited in the swagger editor after creating Action. The body should look like this
" - name: file
in: body
required: false
schema:
type: string
format: binary
"
Be sure to format it consistent with the rest of the Yaml.
The rest of the info is up to you.
Finally Update the connector. You should now be able to use this custom connector in your flows.
Your Atachtion should look like the example below. Key items, you will need to know the Content-type. If you are using ShareFile, you can get it directly from the "Get File Content" step. Just be sure to drill down from the body, ie. @{body('Get_file_content')?['$content-type']}. I used the Get File Metadata step to get the file name. You will need the file extension but not the folder path. Finally, the File MUST be in Binary. If your file is in Base64, use the following: @{base64ToBinary(body('Get_file_content')?['$content'])}
I hope this helps!
Comments
-
Thanks for sharing! I've moved this post to our "Best Practice" category to make sure other members see it 😊
Need more information? 👀 | Help and Learning Center
こんにちは (Konnichiwa), Hallo, Hola, Bonjour, Olá, Ciao! 👋 | Global Discussions