CSV file - last line require

#1

Hello,
This is my first post, so let me introduce myself. My name is Robert and I am from Poland, I just start my adventure with node red, so forgive me some illy questions.
I have a CSV file from dropbox. The file is stored on dropbox by Leaf Spy apk. and contains data from my electric car. The file is an aplication log, so it is biger and biger. I need the last line of this file. Could you help me, how to extract the last line? This is my simple flow, but csv function gives me all data in specific columns, I need the the last one.

#2

Here are some possibilities to solve this:
You can set the csv node to output an array - the last element of the array would be the last line...

Or you can set the csv node to "a message per row" and feed it into a trigger node configured like "send nothing"; "extend delay"; "then send the latest msg object"

Or (if the file is very big), you could use a script to extract only the last line to a separate file.

1 Like
#3

Or you could maybe tail the file live while it is being written so you would always have the last line to hand.

#4

i didnt mention the tail node, cause according to the screenshot, there is a 73% chance op runs n-r on windows :slight_smile:

But should anyone ever use the search, it's good to have it...

#5

Good point.