Export data to Excel #243
-
Hello Gents. Could You help with issue.
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Have you tried writing the data to a CSV file? |
Beta Was this translation helpful? Give feedback.
-
Simple program to write to CSV: plc = PLC() f = open('data.csv', 'w') You'll obviously need to change the IP address, the tag name and the read length. Good luck. |
Beta Was this translation helpful? Give feedback.
Simple program to write to CSV:
from pylogix import PLC
plc = PLC()
plc.IPAddress = '192.168.128.22'
plc.ProcessorSlot = 0
data = plc.Read('conveyor', 300)
sdata = [str(d) for d in data.Value]
print(data)
f = open('data.csv', 'w')
f.writelines("\n".join(sdata))
f.close()
You'll obviously need to change the IP address, the tag name and the read length.
Good luck.