Hi All,
I am trying to find a way to identify whether a user inputted file format is a .csv or .tsv. Since I often find this scenario where the expected input file format is a comma delimited and the user inputs a tab separated file (since both opens up similarly in excel) and breaks rest of the workflow. Any thoughts or suggestions? Thanks in advance!
Best,
G
Solved! Go to Solution.
@geeman Do you just need to know if it is TSV vs CSV (result in true/false), or do you need to be able to import and use it regardless of which it is?
I am under the assumption this is for an application based on the server? If so I can't see an easy way around this as Alteryx seems to return the error 'c:\...tsv' is not valid.
If it is for users running an application on their local machine then there is a relatively straight forward fix but I am under the assumption this isn't the case.
I would perhaps just ensure your users understand the difference between .tsv. and .csv files and how easy it is to convert a .tsv to .csv.
Perhaps I am misinterpreting the problem, and it's actually a .csv file they are trying to input but it is tab delimited within the .csv file (this is possible though it sounds like it isn't!). If this is the case then I believe we can create a fix too.
Ben
Yes, this is for the application based on the server. Ideally the user downloads the file from a crosstab from a Tableau server as csv, edits the file and upload the file though the alteryx process. But the file downloaded is sometimes downloaded as tsv based on the browser & OS. This breaks the Alteryx workflow since it is expecting a csv. So I need to identify the delimiter at the beginning of the workflow.
Thanks for your help @BenMoss and @patrick_mcauliffe.
I would worry less about trying to identify the format and just parse the input as if both were coming in.
In the attached example, you could either drop this in front of your existing workflow or build it into a macro and put it first inline. Try disconnecting one of the inputs and see how it still parses?
Of course you'll probably have to modify it a bit for your specific use. But without knowing much about the data you expect to come in, this is the way I'd do it.
Thank you @BenMoss, @patrick_mcauliffe! To answer your question.. the file extension would be a .csv and not .tsv. So the input logic is supposed to interpret whether it is an actual comma separated or tab separated. I will give it a try with the solutions you have provided. Cheers!
Hi @patrick_mcauliffe, I did some tweaking and this is working just fine... Thanks a lot, appreciate your help!
Best,