Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Owain Williams 479 posts 1410 karma points MVP 6x c-trib
    Apr 22, 2019 @ 11:19
    Owain Williams
    0

    Export Form submissions to Excel via API?

    Hi! Has anyone found a way to export Umbraco Forms data in Excel format via an API call?

    What I'd like to do is once a day, run a task on the server which calls an endpoint and exports the data and saves it to a specific location.

    Any thoughts?

  • Nathan Woulfe 447 posts 1664 karma points MVP 5x hq c-trib
    Apr 22, 2019 @ 11:24
    Nathan Woulfe
    0

    I have nothing useful to add other than this would be really useful - it came up on my list of maybe-todo things, but haven't got to looking at it just yet.

    Difficult when Forms is a black box...

  • Owain Williams 479 posts 1410 karma points MVP 6x c-trib
    Apr 22, 2019 @ 12:35
    Owain Williams
    0

    A response on Twitter from Soren is:

    API controller for exporting.

    Use EPPlus for generating excel, use recordservice for getting data (You might need to rely on intellisense on that though).

    I'm guessing this means, create a controller which a can be called. Maybe treat it as a workflow? https://our.umbraco.com/documentation/Add-ons/umbracoforms/developer/extending/adding-a-workflowtype

    The api controller would be called once a day which would then create the excel spreadsheet.

    Lots of unknown for me on this one.

  • ianhoughton 281 posts 605 karma points c-trib
    Apr 22, 2019 @ 15:37
    ianhoughton
    0

    I think Soren was meaning a web api controller that you can call from outside of Forms. Maybe pass in the form Id as a parameter, then lookup the records in the dB using record service.

    I’ve created plenty of workflows, but these will fire on every submission, so you would potentially only get the one row per spreadsheet?

  • Owain Williams 479 posts 1410 karma points MVP 6x c-trib
    Apr 22, 2019 @ 15:45
    Owain Williams
    0

    That makes a bit more sense to me. Thanks Ian.

    I could create a page in Umbraco which is hidden from nav etc, then as you say, add a form id as a parameter so that if required, I can create another page for another form.

    I'll put my thinking cap on and see if I can do something with this.

  • ianhoughton 281 posts 605 karma points c-trib
    Apr 22, 2019 @ 15:50
    ianhoughton
    0

    I’m typing this on my phone but I think you want to create your controller and inherit from UmbracoApiController which would make it a Web Api method, you don’t then need to make ‘any’ real pages in Umbraco

    https://our.umbraco.com/documentation /Reference/Routing/WebApi/

    All locally declared Umbraco api controllers will be routed under the url path of:

    ~/Umbraco/Api/[YourControllerName]/[MethodName]/[parameter]

    E.g ~/Umbraco/Api/Forms/ExportRecords/[yourFormId]

  • Nathan Woulfe 447 posts 1664 karma points MVP 5x hq c-trib
    Apr 22, 2019 @ 20:08
    Nathan Woulfe
    0

    Then wire up a scheduled task to run once a day, and you're in business

    Would need some way to configure which data goes to which email address too - that could be a config node, a .config file, a custom dashboard etc. Heaps of options.

  • Owain Williams 479 posts 1410 karma points MVP 6x c-trib
    Apr 23, 2019 @ 07:50
    Owain Williams
    0

    Cheers! I planned to start playing about with this last night but then got distracted and started working on another project!! Too many things on the go just now.

    Hope to get on to it maybe later this week.

  • Owain Williams 479 posts 1410 karma points MVP 6x c-trib
    Apr 22, 2019 @ 18:57
    Owain Williams
    0

    I like that - sounds like something I should learn anyway, whether Im using it on my current project. Thanks Ian.

Please Sign in or register to post replies

Write your reply to:

Draft