cancel
Showing results for 
Search instead for 
Did you mean: 

Append data to csv file with out repeating the header row

manohar
Contributor

hi there, i am trying to append all the records for the day to that days CSV file which has date in the file name.

all works fine, if it doesnt fnds the file for the day it creates the file. if it finds the files then it appends the data to the file.

But one thing is keeps adding the column names as well to the file. How can i have the only data be appended and not the column headers?

Thanks
Manohar

4 REPLIES 4

manohar
Contributor

Just an update I tried using Directory Browser snap and it worked fine what I am looking for; but data is lost post this snap, I get the output of the Directory Browser snap which is. not sure if its right solution.

ok2pay_11-06-2020.csv sftp://Sftp.com:22/ok2pay_11-06-2020.csv File unknown 2020-11-05T19:16:07.000-05:00 72 unknown rw-r–r–

image

it errored out because above record and its format of the row is not matching the data columns already there

HI Igor, thanks for looking in. I was able to get this working by adding a mapper after the router and pulling just the original data. heres my final solution. Added Splitter to Flatten array data.

image

Nice! I had a similar problem before for my solution I had a default file where the column names are already written… then use this template pipeline… then on the csv formatter unchecked the write header then in file writter append 🙂

igormicev
Contributor

Hi @manohar,
Are you using the APPEND setting of the file writer?

Then, you check the supported protocols for APPEND in the docs (https://docs-snaplogic.atlassian.net/wiki/spaces/SD/pages/1438927/File+Writer)

  • Append - Append is supported for file, FTP, FTPS and SFTP protocols only.

If all good so far, then one of the csv formatter snaps should be having checked the “include headers” setting and the other one without it checked.

/Igor