# Hourly CSV to historian

**URL:** <https://forum.inductiveautomation.com/t/hourly-csv-to-historian/12779>\
**Category:** Ignition\
**Created:** [March 11, 2017, 9:56pm UTC](https://forum.inductiveautomation.com/t/hourly-csv-to-historian/12779 "2017-03-11T21:56:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [March 11, 2017, 9:56pm UTC](https://forum.inductiveautomation.com/t/hourly-csv-to-historian/12779/1 "2017-03-11T21:56:51Z")

</div>

Continuing my energy metering project …

Some of my energy meters upload CSV files by FTP to my server. The tables are in narrow format so I did a little testing and can get Python to open and parse the files.

```auto
ExportID Date Value
Temperature T1 2017-02-25T23:15:00 36.3
Temperature T2 2017-02-25T23:15:00 36.2
Meter1 kWh 2017-02-25T23:15:00 175814
Meter2 kWh 2017-02-25T23:15:00 3221679
```

Q1. Am I correct in using system.tag.storeTagHistory to allow me to write both t\_stamp and tag value?  
Q2. How do I prevent double entries if a CSV file is parsed twice (during development or after a fault).  
Q3. How should I run the script as a scheduled task, say, once an hour? Should I create a scheduled task / cron to run a client and have the client exit when complete?

Any ideas to prevent me going off on a difficult path would be very welcome.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [March 13, 2017, 8:56pm UTC](https://forum.inductiveautomation.com/t/hourly-csv-to-historian/12779/2 "2017-03-13T20:56:52Z")

</div>

1. If you ultimately want this data to go into Ignition’s tag historian and be retrieved on, for instance, Easy Charts, then you can use system.tag.storeTagHistory - although this function is not guaranteed to scale well.
2. If it’s on an FTP server, then I would just get it off the server, then upload it back with a different filename or extension to indicate that it’s been entered in.
3. A scheduled task could be a gateway timer script that evaluates, say, every 60s (and checks if it’s the top of the hour before continuing execution) or you could use a transaction group on a schedule to flip a boolean tag, then a tag event script on that tag to fire the actual script. Either of these would be much, much better in terms of performance than trying to launch a client.
