Unlike the out of the box ability to export planner to excel, Power Automate does not support this natively. Whilst there is an action to list tasks, some of the data is referenced by GUIDs/IDs or category names, for example assigned to users, bucket ids or labels. I have built an efficient flow that will hopefully allow you to export your planner tasks for a specific plan to a new Excel File, containing a table, ready for you to use elsewhere. This is a proof of concept and so I highly recommend that you test. If there are features that you feel are missing or other fields that you would like included, please drop me a message.
The flow is compact and looks likes follows:
There are 4 key areas to the solution:
1. initial explanation, listing tasks buckets and plan details (for label categories)
2. retrieving all users by ID that have been assigned a task and returning their display name
3. for each task, creating an object of key/values and outputting an array
4. a basic method for creating an Excel File with Table containing the data from the Array
Stage 2:
I ultimately compile an array of distinct UserIds so that I can look them up and create an object of Userid/DisplayName Key/Values.
Output:
This enables all project users to be selected by ID and is a far more efficient way of using get user profile, as we don't need to do this for all tasks where multiple users may be assigned.
Stage 3:
There are 4 scopes to get the more tricky data, but here I gather individual arrays of:
1. assignedTo Display Names
2. CheckList Items
3. Categories/Labels (by bespoke name, colour or fallback category number)
4. CheckList Totals / Count
The output is an object for each item:
Stage 4:
Is a very easy method to create a new excel file, table and populate the rows using an apply to each. You can use Excel Scripts or Graph API to populate a file if you so wish, I have examples of the former on my YouTube.
Please note that if you want to bulk import tasks to planner, I have a video and downloadable flow via my YouTube here https://youtu.be/n3foHWH1XpU. Feel free to check out my YouTube for other ideas and concepts too and don't forget to like and subscribe.
Sample Task JSON can be seen below:
Hi, this look great. In scrip I have error in section 3 - ScopeAppliesCategories - SelectLabels. Any idea how to solve it??
This is an amazing flow that has worked for me but it's giving an empty cell for Created By. How can I go about it to include the created by names just like the assigned to names.
Hi @Anonymous I wonder if it's because you don't have category descriptions? Try changing the expression from ['body/categorydescriptions'] to ['body']?['categorydescriptions'] and it should hopefully return null, rather than error.
Hi @MosK, created by is based on the AAD. You should be able to check the history of the flow for the select as follows:
This is part of the scope from stage 2. If you are not seeing anything, it would be worth exploring the history of this scope to understand why you are not getting the users back.
Damien
Hi Damien,
Thanks for sharing this flow. It helped a lot building one that I need. The only issue I am having up to now is that some tasks do not have labels and in those cases the flow stops with an error. How can I solve this?
Regards,
Arthur
Hi @DamoBird365,
I have the same problem as @Anonymous, and indeed the missing categories are the problem. But I can't find the expression ['body/categorydescriptions'] I should change. Can you help me finding it in the flow?
First of all, @DamoBird365 this is amazing! I love the way you structured it, I have a WAY easier time understanding what is happening here. ❤️
@DamoBird365I am having the same problem as @Anonymous, @Melles, and @AIU where there are no categories and it fails the entire process. If I have categories it works, but any single failure (non category task) does not let the process continue on to "ComposeTaskObject"
Seems like I have to find a way to deal with the empty labels . Coalesce will return the first non "NULL" it finds, but if you have nothing labeled, it will not return anything, hence "" (empty). I need to rewrite the function to accommodate non labeled tasks 😕
I did try changing it from ['body/categorydescriptions'] to ['body']?['categorydescriptions'] but I get the same error, "cannot be evaluated because property '' cannot be selected"
@Mellesthe expression is under "SelectLabels" step, [fx] 'coalesce(...)' under "Map" double clicking lets you edit it if I understood @DamoBird365 correctly, that is what I changed at least.
Hi @ishesb
Thanks for taking a look. The easiest way to resolve if categories/labels are not a requirement would be to remove the "scopeappliedcategories" and also update "composetaskobject" to remove the "Labels" key/value. I understand why you are getting the error where no label exists, my bad for not testing that scenario 🤣
Alternatively, if you are happy to test and feedback, try updating the following:
This worked! Thank you! Now to customize the spreadsheet a bit more for my use! This is wonderful!
Alternatively, if you are happy to test and feedback, try updating the following:
If(empty(first(outputs('ComposeArrayOfLabels'))),'"NONE":true',replace(replace(string(first(outputs('ComposeArrayOfLabels'))),'}',''),'{',''))Damien