How to print 5 values in rows and not columns to excel?

Hello.
I want to read 5 values of

I have several problems:

  1. I need my 5 values in a columns and not rows. New row will be in every inertia and I cant do that.

  2. How to write titles to the columns ? not working in the screenshot

screenshot provided of the output:

code:
const float referenceVolts = 5.0; // the default reference on a 5-volt board

int row_excel = 0; // number of lines

void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
Serial.println("CLEARDATA"); // clear excel sheet
Serial.println("A,B,C,");

}

void loop() {
// put your main code here, to run repeatedly:
static const uint8_t analog_pins[] = {A0, A1, A2, A3, A4};
for (int i = 0; i < 5; i++)
{
int val = analogRead(analog_pins[i]);
float volts = (val / 1023.0) * referenceVolts; // calculate the ratio
Serial.println(volts); // print the value in volts

}
delay(1000);

}

Your post was MOVED to its current location as it is more suitable.

Could you also take a few moments to Learn How To Use The Forum.

Other general help and troubleshooting advice can be found here.
It will help you get the best out of the forum in the future.

I can't figure out the question(s) here, but if you want to present data in a certain way in Excel, then you can always create a sample Excel sheet of how you want it to look and then export that sheet as a CSV file. Then open you favourite text editor and see how the data has been laid out. Then simply have your sketch output the data in a similar format.

Thanks.
My output is rows of numbers and Im looking for columns and not rows .

1 2 3 4

and not
1
2
3
4

So don't use println

Separate the numbers with a comma instead of newline.

  for (int i = 0; i < 5; i++)
  {
    int val = analogRead(analog_pins[i]);
    float volts = (val / 1023.0) * referenceVolts; // calculate the ratio
    Serial.print(volts); // print the value in volts
    if (i < 4)
      Serial.print(',');
  }
  Serial.println();

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.