arduino / arduino-ide

Arduino IDE 2.x
https://www.arduino.cc/en/software
GNU Affero General Public License v3.0
2.3k stars 391 forks source link

Content copied from Serial Monitor output is formatted text #2093

Open IvanchoIotata opened 1 year ago

IvanchoIotata commented 1 year ago

Describe the problem

It is common for Arduino sketches to output serial data to the computer in a delimiter-separated format (AKA "CSV"). This data is usually copied from the Arduino IDE Serial Monitor and then pasted into a spreadsheet program for further manipulation and analysis (e.g., generating charts).

πŸ› Content copied from the Serial Monitor output field is stored in the clipboard as formatted text. This causes it to not be correctly recognized as delimiter-separated data when pasting it into a spreadsheet program.

To reproduce

  1. Upload a sketch to your Arduino board that produces delimiter-separated output. β“˜ A demonstration sketch is provided here: https://github.com/arduino/arduino-ide/issues/2093#issuecomment-1584644719
  2. Open the Arduino IDE Serial Monitor.
  3. Select the output in the Serial Monitor view.
  4. Open a new spreadsheet in your spreadsheet application (e.g., OpenOffice/LibreOffice Calc, Microsoft Excel)
  5. Paste the data from the clipboard to the spreadsheet.

πŸ› The data is pasted in a single column:

image

Expected behavior

The format of the content copied from the Serial Monitor output field is in plain text format (i.e., CF_TEXT).

This will allow it to be recognized as delimiter-separated data when pasted into a spreadsheet application. The application will either automatically import the data into the appropriate spreadsheet columns, or else present an import dialog.

Arduino IDE version

8f8b46fa6fa051777a83c842964de49bf81f6196

Operating system

Windows, Linux, macOS

Operating system version

This is universal behavior

Additional context

The fault does not occur when the Arduino IDE 1.x Serial Monitor is used.


The problem appears to be related to the Serial Monitor output being printed as HTML, which causes it to be copied to the clipboard as "HTML Format" (CF_HTML) data. More information:

https://learn.microsoft.com/en-us/windows/win32/dataxchg/clipboard-formats

Additional reports

Issue checklist

kittaakos commented 1 year ago

Thanks for taking the time and reporting it to us, @IvanchoIotata.

In the context of this GitHub issue, I focus on the copy-pasting of the colon data.

Upload a sketch to your Arduino board that produces delimiter-separated output.

Please share a bare minimum sketch to produce the monitor output you mentioned, and I will check the problem. Thank you!

IvanchoIotata commented 1 year ago

Hello, Thank you for the response.

Here is a simple code that illustrates the problem:

/*************************
 * Test copy a two column tab separated numbers
 * from serial monitor to clipboard and paste in Excel
 * On Arduino 1.8.19 works fine
 * On Arduino IDE 2.X.X the copied data pasted in only one column
 *************************/
void setup() {
  Serial.begin(115200);
  delay(500);
  for(int i = 0; i < 51; i++){
    Serial.print( i );
    Serial.print("\t");
    Serial.println( i * i );
  }
}
void loop() {}
IvanchoIotata commented 1 year ago

Here is the code in zip file: SerialMonitoryCopyPasteTest.zip

IvanchoIotata commented 1 year ago

I have one more suggestion regarding Serial Monitor. To be placed on the side of the Arduino IDE window instead of the bottom. With modern day display there always more need for depth(height) than width. Also the data in the Serial monitor is rarely 10 spaces wide, but can be quite long. It makes sense to place the Serial monitor in a place that more data can be visible.

Nick-Norton commented 1 year ago

I have one more suggestion regarding Serial Monitor. To be placed on the side of the Arduino IDE window instead of the bottom.

Or have the ability to pop the Serial Monitor out, into its own Window. Like the Serial Plotter does.

IvanchoIotata commented 1 year ago

@per1234 Thank you for summarizing the problem in more concise manner.

IvanchoIotata commented 1 year ago

I want to check if there is any progress on this issue.

avandalen commented 1 month ago

Can this issue be put on a priority list, it is important!