How to Import with Copy & Paste
Copy and Paste is one of the fastest ways to get data into DataGraph. The data you paste in is handled differently depending on what you select in the DataGraph file.
In this example, we will paste data into a new file.
To create a new file, click the ‘New File’ button on the Example files window (bottom right), or select File > New (⌘-N).
Try with the following data table. Click and drag to select the data, then select Edit> Copy (⌘-C) in the menu of your browser. That will place the data in your clipboard.
In a new DataGraph file, select Edit > Paste or control-click on the data table and select Paste (⌘-V).
Two columns are created, the column headers are automatically entered, and the data type is properly assigned.
The icon on the left of the column object indicates the data type. In this case, the ‘Country’ column is imported as text and the ‘Population’ is a number.
To make the columns wider, hover the cursor over the dividing line between the columns. Click and drag to change the width.
After increasing the column width, the data looks as follows. Note that the comma separators for the thousands place were removed when we pasted the data.
To display the comma separators, click the left corner of the column object for the ‘Population’ column (disclosure triangle) to expand the object. Change the Display menu to ‘#,###’.
When you paste data into an existing file that already has data, you have three options:
- Paste over columns – Replace all the data in selected columns, including the column names.
- Paste over rows – Replace data in selected rows without changing column names or data types.
- Paste into new columns – Leave existing data as is and add new columns.
Paste over columns
To try this out, open the example files (File > On-line examples) and open the Line Plot example file (Basic section). This file contains data on the vapor pressure of mercury.
Copy the following data to the clipboard.
To paste over the existing data, click the header for the first column to select. Next, hold the shift key while clicking the second column. This will highlight both columns.
Then, use Edit > Paste (⌘-V). This replaces the data and the headers. It also updates the graphs that are using the data, as demonstrated in the following video.
Paste over rows
Instead of selecting columns, this example shows what happens when you highlight rows.
To try this out, use the same file and copy the example data as above. Next, click anywhere in the data table to select a row. To select all the rows, you can use Edit > Select all (⌘-A).
With all the rows selected, the table will look as follows. Notice how the column headers are not highlighted, compared to the example above.
When you paste in the data (Edit > Paste or ⌘-V), the program will show you a pop-up to confirm the location of each column you are pasting.
Click Import to confirm. The data is replaced but the column headers do not change.
Paste new columns
If you want to paste data from the clipboard into new columns, make sure to deselect existing columns/rows.
To deselect columns/rows, click with the mouse pointer away from the table. For example, you can click on the data list as shown below.
When you paste, DataGraph will import the data from the clipboard into new columns.