Appending to CSV

I am trying to write variables to a CSV file.

Everything works well, except when I append to report it just adds it onto the same line. I'd like for it to append onto a new line (row).

Is there a trick to this?

I am currently getting:

Value 1;value 2;value 3

I want:

Value 1
Value 2
Value 3

Thanks

Try adding "\n" to the end of the values, without the quotes.

No dice. Now I just see \n at the end of everything.

They may be escaping it, try appending the values separately, i.e. separate Actions in the rule.

Still seeing it unfortunately

Maybe it would be worth posting some screenshots of the rule you are using...

Great idea. I agree. I am writing this as a little expiriment and I also have a newborn, lol.

That does help to clarify some of the references throughout the rule :slight_smile:

I have been using her frequent nap times to play around with the hub more. My wife hates it.

1 Like

I'm not sure what to suggest myself, apart from separating out those append calls. Hopefully someone else has experience in this.

1 Like

In the area of the rule where you type the text you want to append, hit "enter" to move the cursor to the next line then save.

That was what I had tried first.

Is it possible it is not working because I am on mobile?

Perhaps... the method I described works for me.

So I do it at the end of each statement to make room for the next? Not at the start?

At the end... let me see if i can get a screenshot...

EDIT:


Notice that my text cursor is on line 2.

3 Likes

Initial testing suggests this has done the trick. I'll let the overnight component run, and then update tomorrow! Thank you.

2 Likes

It works great.

I would note that doing this on mobile did not work for whatever reason. It had to be done on a laptop.

2 Likes

That could be a difference in the use of carriage return / line feed characters between your mobile and laptop. If you are keen to work it out you could try opening the file in a text editor that allows for display of those system characters to understand which one's are used. But I would expect that now you have a solution, probably not worth it...

I'm not currently very interested in the mechanics of it.

Mostly just documenting in case some other poor bloke stumbles into this thread with the same problem.

1 Like

Me too :grin:

Download the Hubitat app