Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- JMP User Community
- :
- Discussions
- :
- Paste data from JMP to Excel

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Jan 17, 2018 4:41 AM
(2260 views)

Hello,

I currently have a script which automatically populates a JMP table with Excel data, then runs a non-linear regression and saves the fitted data. I would then like to copy these new columns back into the same, open, Excel document. Is there a simple way to select the new columns, and then copy the data to the clipboard using JSL so I can paste it back in Excel?

Cheers,

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

You need to scan the table and build up a text string that you can put into the clipboard using the Set Clipboard function.

Use the tab escape (\!t) sequence to separate columns and the new line escape sequence (\!N)to create rows

`Set Clipboard( "col 1 row 1\!tcol 2 row 1\!tcol 3 row 1\!Ncol 1 row 2\!tcol 2 row 2\!tcol 3 row 2" );`

-Dave

4 REPLIES 4

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: Paste data from JMP to Excel

@rinosaur ,

Hello. The following piece of code might be useful in achieveing what you are after :

```
// Open Sample Data
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
// Specify Output Folder Location - edit per your needs
OutputFolder = "C:\";
// Get List of Columns
ColNames = dt << Get Column Names("String");
// Specify Columns you desired to copy and paste into excel
DesColumnsList = {"age","sex"};
// Loop through columns to select columns you want
for(i = 1, i <= N Cols(dt), i++,
If(Contains(DesColumnsList,ColNames[i]),
Col = Column(dt,i); // Get Reference for Column
Col << Set Selected(1);
);
);
// Subset Selected columns
dt_New = dt << Subset(Selected Rows(0),Selected Columns(1));
// Save Desired Table
Close(dt_New,Save(OutputFolder || "test.xlsx"));
```

Best

Uday

Uday

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: Paste data from JMP to Excel

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: Paste data from JMP to Excel

@rinosaur,

How about this ?

```
// Opem Sample Data
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
// Write to Excel
Create Excel Workbook("C:\Test.xlsx",{"Big Class"},{"Big"});
// Open Another Sample Data Set
dt1 = Open( "$SAMPLE_DATA/Air Traffic.jmp" );
// Write both tables to existing workbook
Create Excel Workbook("C:\Test.xlsx",{"Big Class","Air Traffic"},{"Big","Air"});
```

However, in your case , you will directly append the data into a new tab in Excel to your workbook using the last step .

So - open you excel workbook as a JMP data table , then have a second data table with the data you want to write and then use Create Excel Workbook as shown above to write to Excel.

If you want all the data in the same tab , just join the JMP data tables and write to Excel . Hope this helps .

Best

Uday

Uday

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

You need to scan the table and build up a text string that you can put into the clipboard using the Set Clipboard function.

Use the tab escape (\!t) sequence to separate columns and the new line escape sequence (\!N)to create rows

`Set Clipboard( "col 1 row 1\!tcol 2 row 1\!tcol 3 row 1\!Ncol 1 row 2\!tcol 2 row 2\!tcol 3 row 2" );`

-Dave