I have a workflow that converts JSON to Excel ( Spreadsheet File node) and then writes the file to my desktop, i.e. /Users/Dick/Desktop/test.xlsx
Now I would like to make this variabel and therefore I need to get the current user’s name or path to his/her desktop.
Is this possible? And if so, how?
Thanks in advance and best regards - Dick
Hi @dickhoning, iirc you were using a Mac for your desktop app, right? I don’t have one myself but you should be able to reference the current users’ home directory with a
So you can probably use
Hi Tom, thanks for your fast reply! Unfortunately, this does not work …
Sorry to hear. Maybe @ivov can suggest an alternative for reading the current user’s desktop path via the desktop app on Mac?
whoami in Execute Command node and plug it into the full path:
thanks … that works … I’ve added Execute Command with whoami and use the following expression:
Can you please also tell how I can make this cross-platform, in other words, make this work on Windows as well … and how to tell whether the workflow gets executed on Mac or Windows?
$env.N8N_DEPLOYMENT_TYPE resolves to
whoami should work on Windows as well iirc
Sounds really cool @dickhoning , congrats! If not sensitive would you mind sharing the workflow? I’m not a dev so these things tend to be over my head but can find it really useful for a personal case I am working on. Does it convert a specific JSON file or does it map any JSON file to excel? Thanks in advance.
Hi Andres, I’m always happy to share what I build! However, the flow is not completely ready yet. I’m still looking for a solution to get the Excel file out via the Respond to Webhook node. In this web hook, I’m getting in JSON via the FileMaker Data API which I then convert to JSON that can be converted by the Spreadsheet File.
the FileMaker JSON looks like this …
"Productnaam": "test one two three ... four ... five",
@pradilla Hi Andres, here’s a copy of the finished workflow … thanks to @MutedJam