Is there a way that I can validate a csv file header?
I have an import action that must always receive a file that has the following header: Code, Name,Number at the correct order and correct header.
How I can I do a validation to know if the imported csv file has the correct header/template?
Hi Marco,
You can make use of BinaryDataToText action from BinaryData extension:
It will convert the binary data to text and then you can see if it starts with Code;Name;Number. Check the debug screenshot from the output of the BinaryDataToText action of a sample CSV:
Your condition could be something like this:
If(Length(BinaryDataToText.Text) >= 16, Substr(BinaryDataToText.Text, 0, 16) = "Code;Name;Number", False )
Hope it helps.
Regards,João
Hi João
For an aditional validation would there a way to validate if the file has aditional columns. I beside these three that are already in the example, if the file had more columns how could avoid that? Thanks
Having never tried that, I'd say you need to check that there is a new line after the three columns. I never tried to do that with substr function but with regex this validation is certainly doable.
Hi João Marques,
can you please provide more details for the above solution u mentioned. like what if we have more columns along with the expected 3 columns?
Thank you,
Saikumar Appana