3

I have an csv file that I open with excel. In it 2 columns of numbers. I'd like to import it to mathematica and plot it. How can I do ?

xzczd
  • 65,995
  • 9
  • 163
  • 468
J.A
  • 1,265
  • 5
  • 14
  • 3
    Mathematica can import CSV files--no need for Excel. Have you search the documentation for "CSV"? – Szabolcs Oct 05 '18 at 14:10

1 Answers1

5

As mentioned in the comment above, the CSV file can be imported programmatically, which has been explained clearly in document of CSV, but I'd like introduce a more user-friendly approach in this answer.

First, copy the data to Mathematica in the following way:

enter image description here

Then plot:

ListPlot@%
xzczd
  • 65,995
  • 9
  • 163
  • 468
  • @JA: To import data from Excel to Mathematica, you might want to try this: SetDirectory["D:\\mathematicaSNAcode_Tugrul"] where D:\\mathematicaSNAcode_Tugrul is the location of the Excel or CVS files to be imported. Then Import["file name.xls", {"Data", 1}] where Data 1 indicates that the data will be imported from Worksheet 1 in case you have several data worksheets in one Excel file. As Szabolcs indicated, CVS files can be imported in the same way as Excel files. – Tugrul Temel Oct 05 '18 at 15:26
  • 1
    @Tebernus As to the capture of file name and directory, there exists user-friendly way, too: https://mathematica.stackexchange.com/a/14741/1871 – xzczd Oct 05 '18 at 15:29
  • Thanks for the useful link. – Tugrul Temel Oct 05 '18 at 18:46