Python Forum
Save output into a Excel Sheet with Format Table
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Save output into a Excel Sheet with Format Table
#1
What can I add to my code
in order to save the output into a excel shett but with format table

this is the code (part of it, due to it is to long)
with PLC() as comm:
    comm.IPAddress = '172.21.11.10'
    comm.ProcessorSlot = 0
    ret = comm.GetPLCTime()
 
    print("Fecha y Hora de Registro Revision Fallas", ret.Value, )
    time.sleep(1)
 
     Estacion = "D2M017"
 
 
    ACTUADOR = comm.Read('D2M_017.Status.Act._1.WBypassed')
    ret = comm.GetPLCTime()
    Numero_Act_EnBypass = 0
    if ACTUADOR.Value == True:
        Sensor = "ACTUADOR 1 WORK SENSOR EN BY PASS"
        Numero_Act_EnBypass = (Numero_Act_EnBypass +1)
        print(Estacion, ret.Value, "D2M017 =",Sensor)
    else:
        Sensor = "ACTUADOR 1 WORK OK"
 
 
 
    ACTUADOR = comm.Read('D2M_017.Status.Act._1.HBypassed')
    ret = comm.GetPLCTime()
    if ACTUADOR.Value == True:
        Sensor = "ACTUADOR 1 HOME SENSOR EN BY PASS"
        Numero_Act_EnBypass = (Numero_Act_EnBypass +1)
        print(Estacion, ret.Value, "D2M017 =",Sensor)
    else:
        Sensor = "ACTUADOR 1 HOME OK"
#ACTUADOR 2
    ACTUADOR = comm.Read('D2M_017.Status.Act._2.WBypassed')
    ret = comm.GetPLCTime()
    if ACTUADOR.Value == True:
        Sensor = "ACTUADOR 2 WORK SENSOR EN BY PASS"
        Numero_Act_EnBypass = (Numero_Act_EnBypass +1)
        print(Estacion, ret.Value, "D2M017 =",Sensor)
    else:
        Sensor = "ACTUADOR 2 WORK OK"
 
 
 
    ACTUADOR = comm.Read('D2M_017.Status.Act._2.HBypassed')
    ret = comm.GetPLCTime()
    if ACTUADOR.Value == True:
        Sensor = "ACTUADOR 2 HOME SENSOR EN BY PASS"
        Numero_Act_EnBypass = (Numero_Act_EnBypass +1)
        print(Estacion, ret.Value, "D2M017 =",Sensor)
    else:
        Sensor = "ACTUADOR 2 HOME OK"
and this is the output

Output:
D2M_250 2020-04-15 14:20 D2M_250 = ACTUDADOR 7 HOME SENSOR BY PASS
I need to split that text into
STATION DATE STATUS
D2M_250 2020-04-15 14:20 D2M_250 = ACTUDADOR 7 HOME SENSOR BY PASS

Attached Files

Thumbnail(s)
   
Reply


Messages In This Thread
Save output into a Excel Sheet with Format Table - by skaailet - Apr-15-2020, 09:11 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Convert Json to table format python_student 4 14,311 Dec-05-2024, 04:32 PM
Last Post: Larz60+
  Python and pandas: Aggregate lines form Excel sheet Glyxbringer 12 4,927 Oct-31-2023, 10:21 AM
Last Post: Pedroski55
  how to save to multiple locations during save cubangt 1 1,267 Oct-23-2023, 10:16 PM
Last Post: deanhystad
Thumbs Up Convert word into pdf and copy table to outlook body in a prescribed format email2kmahe 1 1,609 Sep-22-2023, 02:33 PM
Last Post: carecavoador
  Reading data from excel file –> process it >>then write to another excel output file Jennifer_Jone 0 2,076 Mar-14-2023, 07:59 PM
Last Post: Jennifer_Jone
  Save and Close Excel File avd88 0 6,334 Feb-20-2023, 07:19 PM
Last Post: avd88
  how to read txt file, and write into excel with multiply sheet jacklee26 14 16,748 Jan-21-2023, 06:57 AM
Last Post: jacklee26
  How to properly format rows and columns in excel data from parsed .txt blocks jh67 7 3,732 Dec-12-2022, 08:22 PM
Last Post: jh67
  How to format EasyOCR results in order to save to CSV? cubangt 0 2,255 Sep-02-2022, 02:06 PM
Last Post: cubangt
  Convert .xlsx to Format as Table bnadir55 0 1,329 Aug-11-2022, 06:39 AM
Last Post: bnadir55

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020