I have a csv from a solar inverter and I need to input the data into a SQL database.
The problem I have is that two inverters are in the same csv, so I need to split the csv into two or "do something" with the data from the first, then the second.
This is a sample:
#SmartLogger ESN:102469042181
#INV1 ESN:ES22B0048634
#Time;Upv1;Upv2;Upv3;Upv4;Upv5;Upv6;Upv7;Upv8;Ipv1;Ipv2;Ipv3;Ipv4;Ipv5;Ipv6;Ipv7;Ipv8;Uac1;Uac2;Uac3;Iac1;Iac2;Iac3;Status;Error;Temp;cos;fac;Pac;Qac;Eac;E-Day;E-Total;Cycle Time
08-12-2024 15:30:00;504.3;504.3;502.8;502.8;620.3;620.3;493.0;493.0;0.11;-0.04;0.13;-0.05;0.06;0.00;0.09;0.00;228.7;229.7;228.0;0.640;0.607;0.637;512;0;19.4;0.975;50.00;0.030;0.007;0.01;6.42;162.22;5;
08-12-2024 15:25:00;506.5;506.5;500.2;500.2;631.5;631.5;460.9;460.9;0.10;-0.04;0.12;-0.06;0.04;0.00;0.09;0.00;228.7;229.7;228.0;0.552;0.541;0.563;512;0;19.6;0.994;49.99;0.026;0.003;0.00;6.41;162.21;5;
#INV2 ESN:ES22B0048591
#Time;Upv1;Upv2;Upv3;Upv4;Upv5;Upv6;Upv7;Upv8;Ipv1;Ipv2;Ipv3;Ipv4;Ipv5;Ipv6;Ipv7;Ipv8;Uac1;Uac2;Uac3;Iac1;Iac2;Iac3;Status;Error;Temp;cos;fac;Pac;Qac;Eac;E-Day;E-Total;Cycle Time
08-12-2024 15:30:00;480.3;480.3;492.7;492.7;377.1;377.1;386.9;386.9;-0.07;0.13;0.02;0.05;-0.01;0.07;0.02;0.00;229.6;231.3;231.7;0.510;0.469;0.523;512;0;19.5;0.999;50.00;0.045;-0.002;0.01;6.65;164.65;5;
08-12-2024 15:25:00;478.8;478.8;484.7;484.7;385.1;385.1;410.9;410.9;-0.07;0.12;0.02;0.04;-0.02;0.06;0.00;0.00;229.6;232.3;231.7;0.486;0.451;0.522;512;0;19.6;0.993;49.99;0.036;0.004;0.00;6.64;164.64;5;
so I need to do soemthing with those lines:
08-12-2024 15:30:00;504.3;504.3;502.8;502.8;620.3;620.3;493.0;493.0;0.11;-0.04;0.13;-0.05;0.06;0.00;0.09;0.00;228.7;229.7;228.0;0.640;0.607;0.637;512;0;19.4;0.975;50.00;0.030;0.007;0.01;6.42;162.22;5;
08-12-2024 15:25:00;506.5;506.5;500.2;500.2;631.5;631.5;460.9;460.9;0.10;-0.04;0.12;-0.06;0.04;0.00;0.09;0.00;228.7;229.7;228.0;0.552;0.541;0.563;512;0;19.6;0.994;49.99;0.026;0.003;0.00;6.41;162.21;5;
and then I need to do something with those lines:
08-12-2024 15:30:00;480.3;480.3;492.7;492.7;377.1;377.1;386.9;386.9;-0.07;0.13;0.02;0.05;-0.01;0.07;0.02;0.00;229.6;231.3;231.7;0.510;0.469;0.523;512;0;19.5;0.999;50.00;0.045;-0.002;0.01;6.65;164.65;5;
08-12-2024 15:25:00;478.8;478.8;484.7;484.7;385.1;385.1;410.9;410.9;-0.07;0.12;0.02;0.04;-0.02;0.06;0.00;0.00;229.6;232.3;231.7;0.486;0.451;0.522;512;0;19.6;0.993;49.99;0.036;0.004;0.00;6.64;164.64;5;
nay idea how to distinguish between the both headers?
Header one:
#INV1 ESN:ES22B0048634
Header two: #INV2 ESN:ES22B0048591
those should be ignored:
#Time;Upv1;Upv2;Upv3;Upv4;Upv5;Upv6;Upv7;Upv8;Ipv1;Ipv2;Ipv3;Ipv4;Ipv5;Ipv6;Ipv7;Ipv8;Uac1;Uac2;Uac3;Iac1;Iac2;Iac3;Status;Error;Temp;cos;fac;Pac;Qac;Eac;E-Day;E-Total;Cycle Time
Asked by humnab
(21 rep)
Jul 22, 2025, 08:48 PM
Last activity: Jul 24, 2025, 09:10 PM
Last activity: Jul 24, 2025, 09:10 PM