Finding missing data based on time and date stamp on row of CSV

Good Morning Everyone! Here’s a humdinger for ya!

I have a CSV file that is created from an RTU in the field. This CSV consists of rows of records. Each row represents a moment in time and these moments in time are spaced out in 5 second increments. Due to communication in the field and limitations inside the RTU that WAS being used, there are some moments in time missing. My question for you is:

Is there a way I can use Powershell to query the rows in a file (say 63000 rows of data) and 1) identify where the gaps of data are, given that we should have received data every 5 seconds in a date and time stamp format, and if so, can I then 2) insert “X” amount of rows after the last record to fill in the void(s) between the next records and carry down the previous data recorded from the other columns?

There’s always a way. :wink:

You can easily import CSV data and process them with PowerShell. If they are not sorted yet you can sort them by the time stamp and check the time difference between consecutive data sets. If there is a difference of more than 5 seconds between two consecutive entries you can act accordingly. Why shouldn’t that be possible?

LOL, what I was saying was that I have ZERO clue where to even start with writing code for it. Any links that would help me learn how to do this specific process? Thank you sooo much!

My crystal ball in currently in maintenance … Do you know at least the basics of PowerShell? If not you may start with learning the fundamentals of PowerShell first. If this is a one time task you may be better of hiring a trained IT professional to do the job for you. This might be cheaper and it will most likely be faster.

If you already know a little PowerShell you may get started with the following help topics: