Hey Team,
Im collecting all email attachments and storing it in onedrive. I tried multiple substring functions wasnt able to parse it out.
The Filename of the attachment is filename-2021-02-05.csv
Would we be able to remove the date and just have filename.csv ?
Any help would be appreciated.
Solved! Go to Solution.
Try this instead:
concat(substring(outputs('filename'),0, indexOf(outputs('filename'), concat('-',formatDateTime(utcNow(), 'yyyy')))), '.csv')
This takes everything up to -2021 (or whatever the current year is) and then adds .csv on to the end.
Your 15 characters method also works well:
concat(substring(outputs('filename'),0, sub(length(outputs('filename')), 15)), '.csv')
Try this:
concat(substring(outputs('filename'),0, indexOf(outputs('filename'), '-')), '.csv')
You will need to replace outputs('filename') with whatever dynamic content contains your filename.
Does the year (2021) always match the current year of now?
It should. Even if we can remove last 15 chars and append .csv I think it will work
Try this instead:
concat(substring(outputs('filename'),0, indexOf(outputs('filename'), concat('-',formatDateTime(utcNow(), 'yyyy')))), '.csv')
This takes everything up to -2021 (or whatever the current year is) and then adds .csv on to the end.
Your 15 characters method also works well:
concat(substring(outputs('filename'),0, sub(length(outputs('filename')), 15)), '.csv')
User | Count |
---|---|
92 | |
44 | |
20 | |
19 | |
15 |
User | Count |
---|---|
136 | |
54 | |
43 | |
42 | |
31 |