I need to be able to change the column header to a custom format in order to upload into a separate software. Currently the date is in the format of 08/31/2021. I had to do a dynamic rename in order to change the column header name while preserving the data type of the rows as double meta data type. This is the formula:
datetimeformat(DateTimeAdd(datetimefirstofmonth(),-1,'days'),'%m/%d/%Y')
However, when I open the excel sheet I noticed that the format of the header's cell is in the "general" format. I want to get it to a custom format of mmm-yy. The date will look like Aug-21, but the value will still be 8/31/2021. This is the only way the upload will work for some reason.
Solved! Go to Solution.
Just to clarify if I use the formula datetimeformat(DateTimeAdd(datetimefirstofmonth(),-1,'days'),'%b-%y') which makes the date look like Aug-21 this also does not work. The column header value needs to still be in 08/31/21 format.
Hi @markalves
Maintaining the custom format within an Excel output is possible, but only through using a selected range. So you could in theory do this by configuring your output tool as something similar to this:
You would just need to make sure that the range is large enough to meet your needs. That being said, you will still run into the problem of a string field being written to a date field if you use your formula. Since the field in question has both a date and what appears to be currency in it we'd need to solve for that by first outputting your headers and then outputting your data.
Excel File Before:
Excel Output After Workflow:
Attached is a zipped version of the workflow for you to try out.
If this solves the problem please mark answer as correct, if not let me know!
Cheers!
Phil
Your theory and workflow are spot on for being able to change the header data type without changing the rows data type, so I will accept this solution as an answer.
However I guess it is just a limitation of Alteryx, where I can't have the value of the date as 8/31/21, but have the format be mmm-yy as the visible value in excel. I thought that if I was able to convert the column header to a date meta data type it would solve it, but I get a "null" value when converting the mmm-yy into a date type. If I keep it as a string of mmm-yy (Aug-21), the value is no longer 8/31/21 when I open my excel file, which causes my upload to my other software to fail.