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

- 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
(3984 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

Highlighted

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

Created:
Jan 17, 2018 7:46 AM
| Last Modified: Jan 17, 2018 7:53 AM
(4225 views)
| Posted in reply to message from rinosaur 01-17-2018

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

Highlighted
##

- 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

Highlighted
##

- 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

Created:
Jan 17, 2018 5:07 AM
| Last Modified: Jan 17, 2018 5:09 AM
(3973 views)
| Posted in reply to message from uday_guntupalli 01-17-2018

This is similar to what I was thinking, making the subset and copying from there. But this would make a new workbook, correct? I am looking to copy the subset to the clipboard and then later on paste into the original workbook if possible.

Highlighted
##

- 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

Created:
Jan 17, 2018 5:19 AM
| Last Modified: Jan 17, 2018 6:40 AM
(3969 views)
| Posted in reply to message from rinosaur 01-17-2018

@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

Highlighted

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

Created:
Jan 17, 2018 7:46 AM
| Last Modified: Jan 17, 2018 7:53 AM
(4226 views)
| Posted in reply to message from rinosaur 01-17-2018

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

Article Labels

There are no labels assigned to this post.