Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

My Fortran code outputs two columns of data to the screen in a terminal. When I copy that to a spreadsheet, it always gets entered as "text" format. Is there a way to convert it to data?

I've tried many ways, including first copying it to a file, then loading the file to the spreadsheet, which fails.

Thanks a lot.

share|improve this question

1 Answer 1

By data you probably mean "number"? Since it could be anything, like "date" or "location" or something, and since you do not provide any example of your data, I assume the following:

  1. your output looks something like this:

    10 10.1

    20 20.0

    30 3000.

    40 4e1

  2. You want to have it formatted as a two columns of numbers that you can e.g. sum up in the spreadsheet.

One solution could be this:

  • Save the output in a file (e.g. by running your program with like this: myprogram >> mydatafile.txt
  • Open the file with libreoffice (or openoffice). This should look like the following:

LibreOffice import dialog

Take care to select the correct separator (whatever is between your columns, here it is a space, but your program could write commas between the numbers...).

  • Click on "OK" to import.
  • Now your spreadsheet should look like this:

Imported data

  • And you can use summation over the cells:

enter image description here

share|improve this answer
    
Upvoted. Nice answer. –  Peachy Oct 26 '12 at 14:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.