{"id":6530,"date":"2016-11-01T11:11:09","date_gmt":"2016-11-01T15:11:09","guid":{"rendered":"http:\/\/blog.originlab.com\/?p=6530"},"modified":"2018-11-15T11:18:33","modified_gmt":"2018-11-15T16:18:33","slug":"dynamic-data-exchange-dde-with-excel-workbooks-in-origin-2017","status":"publish","type":"post","link":"https:\/\/blog.originlab.com\/ja\/dynamic-data-exchange-dde-with-excel-workbooks-in-origin-2017","title":{"rendered":"Use Excel Workbooks in Origin 2017"},"content":{"rendered":"<p>In this blog post we&#8217;ll be discussing one of Origin&#8217;s little known features, the ability to link Excel files to OPJs using the Microsoft DDE protocol. In Origin you can not only import Excel data\u00a0but rather open Excel files themselves within the Origin workspace. This allows you to edit these files in real time and save changes to your original, or otherwise modify the original Excel file and see these changes reflected in any linked books in Origin. To do this you will need Excel installed on your computer as the program\u00a0will be opened inside the workspace itself. You can download\u00a0a sample OPJ file containing linked Excel files <a href=\"http:\/\/blog.originlab.com\/wp-content\/uploads\/2016\/07\/SampleExcelOPJ.zip\">here<\/a>.<\/p>\n<p>One can open an Excel file from within Origin by going to <strong>File&gt;Open Excel<\/strong> (Ctrl+E) or create a new Excel workbook by selecting\u00a0<strong>File&gt;New&gt;Excel<\/strong>. In previous\u00a0versions of Origin these functions also appeared as buttons by default; should you want to add these to your toolbar for easy access, you can do this by going to <strong>View&gt;Toolbars<\/strong> (Ctrl+T) and navigating to the\u00a0the <strong>Button Groups<\/strong> tab. In the <strong>Standard<\/strong> button group you will find the icons for the New Excel book and Open Excel book functions appearing as they do below-<\/p>\n<div><img decoding=\"async\" src=\"file:\/\/\/C:\\Users\\ken\\Documents\\Tencent Files\\3022534040\\Image\\QR)M4L2IV}4Y(2HHHSQ]HKQ.jpg\" \/><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-6533\" src=\"http:\/\/blog.originlab.com\/wp-content\/uploads\/2016\/06\/Customize.png\" alt=\"Customize\" width=\"204\" height=\"255\" srcset=\"https:\/\/blog.originlab.com\/wp-content\/uploads\/2016\/06\/Customize.png 454w, https:\/\/blog.originlab.com\/wp-content\/uploads\/2016\/06\/Customize-240x300.png 240w\" sizes=\"auto, (max-width: 204px) 100vw, 204px\" \/><\/div>\n<div>These buttons can be added to any toolbar by dragging and dropping them to anywhere in the Origin workspace.<\/div>\n<div><\/div>\n<div><span style=\"text-decoration: underline;\"><strong>1. External Excel Files<\/strong><\/span><\/div>\n<p>Let&#8217;s begin by opening any external Excel file. Using the Open Excel menu option, navigate to an .xls or .xlsx file and open it. If an error message appears saying &#8220;Origin is unable to detect a proper installation of Excel&#8221;, go back and double-check that Excel is installed or otherwise if you have correct permissions for it\u00a0on a shared network.<\/p>\n<p>Once the file is opened, the Excel toolbar will appear within the Origin workspace. You will also notice that the xlsx worksheet&#8217;s graphic user interface (GUI) is Excel&#8217;s rather than Origin&#8217;s standard worksheet GUI because Excel is running within Origin.<\/p>\n<p>The path for this file is listed in the title bar. Every time we change the values in this worksheet and save, the original file will be updated.<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-6535\" src=\"http:\/\/blog.originlab.com\/wp-content\/uploads\/2016\/06\/Customize3.png\" alt=\"Customize3\" width=\"373\" height=\"198\" srcset=\"https:\/\/blog.originlab.com\/wp-content\/uploads\/2016\/06\/Customize3.png 957w, https:\/\/blog.originlab.com\/wp-content\/uploads\/2016\/06\/Customize3-300x159.png 300w, https:\/\/blog.originlab.com\/wp-content\/uploads\/2016\/06\/Customize3-768x407.png 768w\" sizes=\"auto, (max-width: 373px) 100vw, 373px\" \/><\/p>\n<p>When an Excel window is open you may notice there are only 3 menus: File, Plot and Window, available on the top of Origin workspace. This is because the file is being ported through Excel within Origin.\u00a0To fully utilize Origin&#8217;s plotting and analysis features with this data, you can copy it\u00a0from this Excel window\u00a0and then select a cell in Origin workbook and choose <strong>Edit&gt;Paste link,<\/strong>\u00a0use the shortcut <strong>Ctrl+Alt+V,\u00a0<\/strong>or right click and choose\u00a0<strong>Paste Link<\/strong>. This will create a DDE link between the Excel data and the Origin workbook so when values in Excel are changed, the linked data in Origin workbook will change as well.<\/p>\n<p>If you save an OPJ\u00a0containing an Excel workbook, subsequently modify the external Excel file, and reopen the OPJ, its contents in Origin will be updated as well. This feature can be especially\u00a0useful for users whose instruments automatically output to a Excel files, or for users that have more experience with Excel than Origin.<\/p>\n<p><strong><span style=\"text-decoration: underline;\">2. Relative\u00a0<\/span><span style=\"text-decoration: underline;\">Path Excel\u00a0Files<\/span><\/strong><\/p>\n<p>The one disadvantage of\u00a0the previous method is that it is &#8220;path dependent&#8221;.\u00a0Whenever the Excel file is moved to a different folder, or the related OPJ is opened on a different computer, the DDE link will be broken and Origin will prompt you to locate that Excel file.<\/p>\n<p>For this reason you may want to save your Excel file in a &#8220;relative&#8221; path with the OPJ, i.e. the same folder as the OPJ.<\/p>\n<p>If you haven&#8217;t saved the opj yet, or the opj was saved to a folder totally different from Excel file location. Right click on the title bar of the Excel book and selecting\u00a0<strong>Properties<\/strong>.\u00a0In the dialog, click &#8220;<strong>Switch to OPJ Path upon Saving<\/strong>&#8221; button. The next time the OPJ is saved, it will place a copy of the Excel file in that same folder.<\/p>\n<p>If you already saved the OPJ\u00a0file in the same folder as the Excel file or some folder above the Excel file, you still need to check the &#8220;<strong>Relative to current project (OPJ) path<\/strong>&#8221; checkbox. In such case the &#8220;<strong>Switch to OPJ Path upon Saving<\/strong>&#8221; button is grayed out. No extra copy of the Excel file will be saved in such case when save OPJ.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-6536\" src=\"http:\/\/blog.originlab.com\/wp-content\/uploads\/2016\/06\/Customize4.png\" alt=\"Customize4\" width=\"273\" height=\"364\" srcset=\"https:\/\/blog.originlab.com\/wp-content\/uploads\/2016\/06\/Customize4.png 456w, https:\/\/blog.originlab.com\/wp-content\/uploads\/2016\/06\/Customize4-225x300.png 225w\" sizes=\"auto, (max-width: 273px) 100vw, 273px\" \/><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-6538\" src=\"http:\/\/blog.originlab.com\/wp-content\/uploads\/2016\/06\/Customize6.png\" alt=\"Customize6\" width=\"384\" height=\"220\" srcset=\"https:\/\/blog.originlab.com\/wp-content\/uploads\/2016\/06\/Customize6.png 899w, https:\/\/blog.originlab.com\/wp-content\/uploads\/2016\/06\/Customize6-300x172.png 300w, https:\/\/blog.originlab.com\/wp-content\/uploads\/2016\/06\/Customize6-768x441.png 768w\" sizes=\"auto, (max-width: 384px) 100vw, 384px\" \/><\/p>\n<p>After closing out of the properties dialog, the Excel window title in Origin will indicate that the file is saved in that relative path. Please make sure give both the OPJ and the relative Excel file and keep their relative path. This way when other users open the OPJ on other computers, the link between the two files will remain unbroken regardless of where they are stored.<\/p>\n<p>Note: In versions of Origin prior to 2017, all OPJs with\u00a0DDE links (Copy\/Paste Links) between Excel and Origin workbooks, would prompt the following message upon opening them-<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6540\" src=\"http:\/\/blog.originlab.com\/wp-content\/uploads\/2016\/06\/QQ-Photo20160629172930.jpg\" alt=\"QQ Photo20160629172930\" width=\"329\" height=\"148\" srcset=\"https:\/\/blog.originlab.com\/wp-content\/uploads\/2016\/06\/QQ-Photo20160629172930.jpg 329w, https:\/\/blog.originlab.com\/wp-content\/uploads\/2016\/06\/QQ-Photo20160629172930-300x135.jpg 300w\" sizes=\"auto, (max-width: 329px) 100vw, 329px\" \/><\/p>\n<p>and the following when closing Origin-<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-6541\" src=\"http:\/\/blog.originlab.com\/wp-content\/uploads\/2016\/06\/QQ-Photo20160629172600.jpg\" alt=\"QQ Photo20160629172600\" width=\"385\" height=\"128\" srcset=\"https:\/\/blog.originlab.com\/wp-content\/uploads\/2016\/06\/QQ-Photo20160629172600.jpg 487w, https:\/\/blog.originlab.com\/wp-content\/uploads\/2016\/06\/QQ-Photo20160629172600-300x100.jpg 300w\" sizes=\"auto, (max-width: 385px) 100vw, 385px\" \/><\/p>\n<p>Starting in Origin 2017, any Excel file is saved with relative path to an Origin OPJ file and also DDE linking, will no longer trigger these messages.<\/p>\n<p><span style=\"text-decoration: underline;\"><strong>3. Internal Excel Files<\/strong><\/span><\/p>\n<p>If you would rather not save your Excel data as a separate file, Origin also gives users the option to save Excels internally in your OPJ like any other workbook. To enable this feature all we have to do is open the <strong>Workbook Properties<\/strong> dialog for the Excel sheet, and change the Save As option from External to <strong>Internal<\/strong>.<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-6536\" src=\"http:\/\/blog.originlab.com\/wp-content\/uploads\/2016\/06\/Customize4.png\" alt=\"Customize4\" width=\"298\" height=\"397\" srcset=\"https:\/\/blog.originlab.com\/wp-content\/uploads\/2016\/06\/Customize4.png 456w, https:\/\/blog.originlab.com\/wp-content\/uploads\/2016\/06\/Customize4-225x300.png 225w\" sizes=\"auto, (max-width: 298px) 100vw, 298px\" \/><br \/>\nUpon closing this dialog the word [Internal] will appear in the title bar of the Excel workbook, indicating that the Excel file is now internal object of the OPJ without any DDE linking. Once this has been done, any further changes made on the original external Excel file, will have no effect on this workbook.\u00a0Internal Excel files make it easy to OPJs as no additional .XLS\/.XLSX files are needed.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this blog post we&#8217;ll be discussing one of Origin&#8217;s &hellip; <\/p>","protected":false},"author":1070,"featured_media":7330,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_hide_featured_image":false,"_jetpack_featured_image_duplicate_dismissed":0,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[3],"tags":[],"class_list":["post-6530","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-data-handling"],"jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p7DvU2-1Hk","jetpack_likes_enabled":true,"jetpack_featured_media_url":"https:\/\/blog.originlab.com\/wp-content\/uploads\/2016\/11\/DDE-with-Excel-Workbooks.png","post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/blog.originlab.com\/ja\/wp-json\/wp\/v2\/posts\/6530","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.originlab.com\/ja\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.originlab.com\/ja\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.originlab.com\/ja\/wp-json\/wp\/v2\/users\/1070"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.originlab.com\/ja\/wp-json\/wp\/v2\/comments?post=6530"}],"version-history":[{"count":31,"href":"https:\/\/blog.originlab.com\/ja\/wp-json\/wp\/v2\/posts\/6530\/revisions"}],"predecessor-version":[{"id":7621,"href":"https:\/\/blog.originlab.com\/ja\/wp-json\/wp\/v2\/posts\/6530\/revisions\/7621"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.originlab.com\/ja\/wp-json\/wp\/v2\/media\/7330"}],"wp:attachment":[{"href":"https:\/\/blog.originlab.com\/ja\/wp-json\/wp\/v2\/media?parent=6530"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.originlab.com\/ja\/wp-json\/wp\/v2\/categories?post=6530"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.originlab.com\/ja\/wp-json\/wp\/v2\/tags?post=6530"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}