Question

cannot write headers in csv file

  • 14 September 2022
  • 10 replies
  • 47 views

is there a way to write headers first like the ones in yellow rows in the screenshot before adding the needed columns after in a csv file ?

after the 4th row the data should be displayed as a normal csv file, However i cannot figure out how to write the first 3 rows .

 


10 replies

Userlevel 2
Badge

@N_ali


Based on how data is structured in a CSV, we understand headers as the very first row, meaning that it contains the column name.

 

I don't think we support adding multiple rows as headers. If you are a customer my recommendation will be to open a feature request

and if the file was in xlsx format , it’s not supported either ?

Userlevel 2
Badge

They are technically the same, at the end our records are a map of key values, so we take the header (first row) as keys and then the subsequent rows as values

Noted.
Thanks.

 

Userlevel 2
Badge +1

@N_ali 

If you want to add header , you can try using scripting processor .  

@N_ali

If you want to add header , you can try using scripting processor .  

Can you please provide me with an example on how to add the above headers to a csv/xlsx file ?

Userlevel 2
Badge +1

@N_ali 

I will try to provide the code snippet for that.

Let me clear your need , you need headers columns should be after the data row.

If you can provide me a sample file which you are trying and your expected result then i can help you on that.

 

@N_ali

I will try to provide the code snippet for that.

Let me clear your need , you need headers columns should be after the data row.

If you can provide me a sample file which you are trying and your expected result then i can help you on that.

 

Here is the scenario:

  1. The origin will be an sftp server , I will take the input csv file and parse its content.
  2. The content is awb number and tracking number , ….. etc.
  3. i want to write this content in another file ( like the one attached ).

The only difference is that i need to write three rows first that are not included in the data ( the first three yellow rows in the attached file) then writing the header row then the actual data as usual  .

 

Userlevel 2
Badge +1

@N_ali 

 

Please find attached the pipeline for your case and try it from you and let me know if it helps.

 

Userlevel 2
Badge +1

@N_ali

Result based on the input provided bu you. Please change the date format if you need .

 

Reply