{"id":197010,"date":"2023-10-02T11:18:35","date_gmt":"2023-10-02T15:18:35","guid":{"rendered":"https:\/\/ibkrcampus.com\/?p=197010"},"modified":"2023-10-02T11:18:13","modified_gmt":"2023-10-02T15:18:13","slug":"rdcomclient-read-and-write-excel-and-call-vba-macro-in-r","status":"publish","type":"post","link":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/rdcomclient-read-and-write-excel-and-call-vba-macro-in-r\/","title":{"rendered":"RDCOMClient: Read and Write Excel, and Call VBA Macro in R"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">This post gives a short introduction to the&nbsp;<strong>RDCOMClient<\/strong>&nbsp;R package, which provides a variety of functionalities. Our focus is on reading from and writing to Excel, and call VBA macro function in R.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a><\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-introduction\">Introduction<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Using&nbsp;<strong>RDCOMClient<\/strong>&nbsp;R package, we can read from and write to Excel spreadsheet, furthermore, call VBA macro function in R. Of course this VBA is running in Excel not R. We can get results which are returned from VBA macro which was developed earlier.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This feature is very useful when this macro calls DLL, which is hard to be called in R for some reason. At last, we can get the same effect of&nbsp;<strong>calling DLL in R indirectly<\/strong>&nbsp;by using RDCOMClient package.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-installing\">Installing<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Unlike other packages,&nbsp;<strong>RDCOMClient<\/strong>&nbsp;is installed using the following command.&nbsp;<strong>It seems that the second installation is working and the first is not.<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">install.packages(&#8220;RDCOMClient&#8221;,repos=&#8221;https:\/\/www.omegahat.net\/R&#8221;)<br>or<br><strong>devtools::install_github(&#8220;omegahat\/RDCOMClient&#8221;)<\/strong><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Excel Example with VBA macro<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The following figure shows the operation of&nbsp;<strong>macro1()<\/strong>&nbsp;function by clicking [<strong>run macro1<\/strong>] rectangular button. macro1() returns squares of input variables simply.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"828\" height=\"408\" data-src=\"\/campus\/wp-content\/uploads\/sites\/2\/2023\/10\/macro_run-shleeai.png\" alt=\"\" class=\"wp-image-197011 lazyload\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/10\/macro_run-shleeai.png 828w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/10\/macro_run-shleeai-700x345.png 700w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/10\/macro_run-shleeai-300x148.png 300w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/10\/macro_run-shleeai-768x378.png 768w\" data-sizes=\"(max-width: 828px) 100vw, 828px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 828px; aspect-ratio: 828\/408;\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The VBA code of macro1() is as follows.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">Sub macro1()\n \n    For i = 1 To 10\n        Worksheets(\"Sheet1\").Range(\"D2\").Offset(i, 0).Value _\n        = WorksheetFunction.Power( _\n            Worksheets(\"Sheet1\").Range(\"C2\").Offset(i, 0).Value, 2)\n    Next\n    \nEnd Sub<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">R code<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The following R code implements three operations:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Write input array to Excel<\/li>\n\n\n\n<li>Run macro1()<\/li>\n\n\n\n<li>Read output array from Excel<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">R code is simple and self-contained so that you can easily understand it. For convenience, we make two functions : f_read_vector() and f_write_vector().<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">#=========================================================================#\n# Financial Econometrics &amp; Derivatives, ML\/DL using R, Python, Tensorflow  \n# by Sang-Heon Lee \n#\n# https:\/\/shleeai.blogspot.com\n#-------------------------------------------------------------------------#\n# Read and Write Excel in R, also call VBA macro in R using RDCOMClient\n#\n# Install package (Not available on CRAN at 12 June 2019)\n# install.packages(\"RDCOMClient\", repos = \"https:\/\/www.omegahat.net\/R\")\n#=========================================================================#\n \nlibrary(RDCOMClient)\n \ngraphics.off()  # clear all graphs\nrm(list = ls()) # remove all files from your workspace\n \n#===============================================================================\n# functions using RDCOMClient\n#===============================================================================\n \nf_read_vector &lt;- function(xlWbk1, sheet1, range1){\n    \n    sheet &lt;- xlWbk1$Worksheets(sheet1)\n    range &lt;- sheet$Range(range1)\n    data  &lt;- do.call(\"cbind\",range[[\"Value\"]])\n    data  &lt;- matrix(unlist(data), dim(data)[1], dim(data)[2])\n    return(data)\n}\n \nf_write_vector &lt;- function(xlWbk1, sheet1, range1, data1) {\n    \n    sheet &lt;- xlWbk1$Worksheets(sheet1)\n    range &lt;- sheet$Range(range1)\n    range[[\"Value\"]] &lt;- asCOMArray(data1)\n}\n \n#===========================================================\n# MAIN\n#===========================================================\n    \n    # set working directory\n    setwd(\"D:\/SHLEE\/blog\/excel_com\")\n    \n    # Create Excel Application\n    xlApp &lt;- COMCreate(\"Excel.Application\")\n    \n    # Open the Macro Excel book\n    fn &lt;- \"sample_excel.xlsm\"\n    xlWbk &lt;- xlApp$Workbooks()$Open(paste0(getwd(),\"\/\",fn))\n    \n    # use TRUE for Excel Spreadsheet to be visible\n    xlApp[['Visible']] &lt;- FALSE \n \n#===========================================================\n# Communicate between R and Excel\n#===========================================================\n \n    # Arguments for Excel Spreadsheet and VBA macro\n    sheet      &lt;- \"Sheet1\"\n    range_in   &lt;- \"C3:C12\"\n    range_out  &lt;- \"D3:D12\"\n    macro_name &lt;- \"macro1\"\n    \n    #----------------\n    # Example 1\n    #----------------\n    \n    # 1) write input values from R to Excel\n    data_in &lt;- 1:10\n    f_write_vector(xlWbk, sheet, range_in, data_in) \n    \n    # 2) run Excel macro\n    xlApp$Run(macro_name)\n    \n    # 3) read output values from R to Excel\n    data_out &lt;- f_read_vector(xlWbk, sheet, range_out)\n \n    print(cbind(data_in, data_out))\n    \n    #----------------\n    # Example 2\n    #----------------\n    \n    data_in &lt;- rnorm(10)\n    f_write_vector(xlWbk, sheet, range_in, data_in) \n    xlApp$Run(macro_name)\n    data_out &lt;- f_read_vector(xlWbk, sheet, range_out)\n    print(cbind(data_in, data_out))\n    \n#===========================================================\n# save and quit\n#===========================================================\nxlWbk$close(TRUE); xlApp$Quit() <\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Results<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The following console shows two outputs for each input array. This output is calculated in Excel by using VBA function not by using R.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"717\" height=\"252\" data-src=\"\/campus\/wp-content\/uploads\/sites\/2\/2023\/10\/R_output-shleeai.png\" alt=\"\" class=\"wp-image-197012 lazyload\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/10\/R_output-shleeai.png 717w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/10\/R_output-shleeai-700x246.png 700w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/10\/R_output-shleeai-300x105.png 300w\" data-sizes=\"(max-width: 717px) 100vw, 717px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 717px; aspect-ratio: 717\/252;\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">In fact, running the above R code results in the following calculation outputs of Excel spreadsheet. R is only to read these results.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"828\" height=\"411\" data-src=\"\/campus\/wp-content\/uploads\/sites\/2\/2023\/10\/output-shlee-ai-r-excel.png\" alt=\"\" class=\"wp-image-197014 lazyload\" data-srcset=\"https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/10\/output-shlee-ai-r-excel.png 828w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/10\/output-shlee-ai-r-excel-700x347.png 700w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/10\/output-shlee-ai-r-excel-300x149.png 300w, https:\/\/ibkrcampus.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/10\/output-shlee-ai-r-excel-768x381.png 768w\" data-sizes=\"(max-width: 828px) 100vw, 828px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 828px; aspect-ratio: 828\/411;\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Conclusion<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">This post deals with a simple exercise (reading and writing) of&nbsp;<strong>RDCOMClient<\/strong>&nbsp;R package. In particular, when VBA macro function calls DLL, we can use this DLL indirectly by calling not DLL but its wrapper VBA macro. This is useful when you have difficulties in calling DLL directly in R for some reason.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>Originally posted on <a href=\"https:\/\/shleeai.blogspot.com\/2021\/07\/rdcomclient-read-and-write-excel-and.html\">SHLee AI Financial Model<\/a> blog.<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This post gives a short introduction to the\u00a0RDCOMClient\u00a0R package, which provides a variety of functionalities<\/p>\n","protected":false},"author":662,"featured_media":194443,"comment_status":"open","ping_status":"closed","sticky":true,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[339,343,338,341,342],"tags":[806,5878,487,16056,6591,16057],"contributors-categories":[13728],"class_list":["post-197010","post","type-post","status-publish","format-standard","has-post-thumbnail","category-data-science","category-programing-languages","category-ibkr-quant-news","category-quant-development","category-r-development","tag-data-science","tag-excel","tag-r","tag-rdcomclient","tag-rstats","tag-vba","contributors-categories-sh-fintech-modeling"],"pp_statuses_selecting_workflow":false,"pp_workflow_action":"current","pp_status_selection":"publish","acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.9 (Yoast SEO v28.6) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>RDCOMClient: Read and Write Excel, and Call VBA Macro in R<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.interactivebrokers.com\/campus\/wp-json\/wp\/v2\/posts\/197010\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"RDCOMClient: Read and Write Excel, and Call VBA Macro in R | IBKR Campus US\" \/>\n<meta property=\"og:description\" content=\"This post gives a short introduction to the\u00a0RDCOMClient\u00a0R package, which provides a variety of functionalities\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/rdcomclient-read-and-write-excel-and-call-vba-macro-in-r\/\" \/>\n<meta property=\"og:site_name\" content=\"IBKR Campus US\" \/>\n<meta property=\"article:published_time\" content=\"2023-10-02T15:18:35+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/08\/r-programming-coffee-laptop-desk.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1000\" \/>\n\t<meta property=\"og:image:height\" content=\"563\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Sang-Heon Lee\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sang-Heon Lee\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\n\t    \"@context\": \"https:\\\/\\\/schema.org\",\n\t    \"@graph\": [\n\t        {\n\t            \"@type\": \"NewsArticle\",\n\t            \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/rdcomclient-read-and-write-excel-and-call-vba-macro-in-r\\\/#article\",\n\t            \"isPartOf\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/rdcomclient-read-and-write-excel-and-call-vba-macro-in-r\\\/\"\n\t            },\n\t            \"author\": {\n\t                \"name\": \"Sang-Heon Lee\",\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/person\\\/0a959ff9de7f0465a07baa1fe1ae0200\"\n\t            },\n\t            \"headline\": \"RDCOMClient: Read and Write Excel, and Call VBA Macro in R\",\n\t            \"datePublished\": \"2023-10-02T15:18:35+00:00\",\n\t            \"mainEntityOfPage\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/rdcomclient-read-and-write-excel-and-call-vba-macro-in-r\\\/\"\n\t            },\n\t            \"wordCount\": 374,\n\t            \"commentCount\": 0,\n\t            \"publisher\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#organization\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/rdcomclient-read-and-write-excel-and-call-vba-macro-in-r\\\/#primaryimage\"\n\t            },\n\t            \"thumbnailUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2023\\\/08\\\/r-programming-coffee-laptop-desk.jpg\",\n\t            \"keywords\": [\n\t                \"Data Science\",\n\t                \"Excel\",\n\t                \"R\",\n\t                \"RDCOMClient\",\n\t                \"rstats\",\n\t                \"VBA\"\n\t            ],\n\t            \"articleSection\": [\n\t                \"Data Science\",\n\t                \"Programming Languages\",\n\t                \"Quant\",\n\t                \"Quant Development\",\n\t                \"R Development\"\n\t            ],\n\t            \"inLanguage\": \"en-US\",\n\t            \"potentialAction\": [\n\t                {\n\t                    \"@type\": \"CommentAction\",\n\t                    \"name\": \"Comment\",\n\t                    \"target\": [\n\t                        \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/rdcomclient-read-and-write-excel-and-call-vba-macro-in-r\\\/#respond\"\n\t                    ]\n\t                }\n\t            ]\n\t        },\n\t        {\n\t            \"@type\": \"WebPage\",\n\t            \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/rdcomclient-read-and-write-excel-and-call-vba-macro-in-r\\\/\",\n\t            \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/rdcomclient-read-and-write-excel-and-call-vba-macro-in-r\\\/\",\n\t            \"name\": \"RDCOMClient: Read and Write Excel, and Call VBA Macro in R | IBKR Campus US\",\n\t            \"isPartOf\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#website\"\n\t            },\n\t            \"primaryImageOfPage\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/rdcomclient-read-and-write-excel-and-call-vba-macro-in-r\\\/#primaryimage\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/rdcomclient-read-and-write-excel-and-call-vba-macro-in-r\\\/#primaryimage\"\n\t            },\n\t            \"thumbnailUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2023\\\/08\\\/r-programming-coffee-laptop-desk.jpg\",\n\t            \"datePublished\": \"2023-10-02T15:18:35+00:00\",\n\t            \"inLanguage\": \"en-US\",\n\t            \"potentialAction\": [\n\t                {\n\t                    \"@type\": \"ReadAction\",\n\t                    \"target\": [\n\t                        \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/rdcomclient-read-and-write-excel-and-call-vba-macro-in-r\\\/\"\n\t                    ]\n\t                }\n\t            ]\n\t        },\n\t        {\n\t            \"@type\": \"ImageObject\",\n\t            \"inLanguage\": \"en-US\",\n\t            \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/rdcomclient-read-and-write-excel-and-call-vba-macro-in-r\\\/#primaryimage\",\n\t            \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2023\\\/08\\\/r-programming-coffee-laptop-desk.jpg\",\n\t            \"contentUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2023\\\/08\\\/r-programming-coffee-laptop-desk.jpg\",\n\t            \"width\": 1000,\n\t            \"height\": 563,\n\t            \"caption\": \"Quant\"\n\t        },\n\t        {\n\t            \"@type\": \"WebSite\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#website\",\n\t            \"url\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/\",\n\t            \"name\": \"IBKR Campus US\",\n\t            \"description\": \"Financial Education from Interactive Brokers\",\n\t            \"publisher\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#organization\"\n\t            },\n\t            \"potentialAction\": [\n\t                {\n\t                    \"@type\": \"SearchAction\",\n\t                    \"target\": {\n\t                        \"@type\": \"EntryPoint\",\n\t                        \"urlTemplate\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/?s={search_term_string}\"\n\t                    },\n\t                    \"query-input\": {\n\t                        \"@type\": \"PropertyValueSpecification\",\n\t                        \"valueRequired\": true,\n\t                        \"valueName\": \"search_term_string\"\n\t                    }\n\t                }\n\t            ],\n\t            \"inLanguage\": \"en-US\"\n\t        },\n\t        {\n\t            \"@type\": \"Organization\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#organization\",\n\t            \"name\": \"Interactive Brokers\",\n\t            \"alternateName\": \"IBKR\",\n\t            \"url\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/\",\n\t            \"logo\": {\n\t                \"@type\": \"ImageObject\",\n\t                \"inLanguage\": \"en-US\",\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/logo\\\/image\\\/\",\n\t                \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2024\\\/05\\\/ibkr-campus-logo.jpg\",\n\t                \"contentUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2024\\\/05\\\/ibkr-campus-logo.jpg\",\n\t                \"width\": 669,\n\t                \"height\": 669,\n\t                \"caption\": \"Interactive Brokers\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/logo\\\/image\\\/\"\n\t            },\n\t            \"publishingPrinciples\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/about-ibkr-campus\\\/\",\n\t            \"ethicsPolicy\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/cyber-security-notice\\\/\"\n\t        },\n\t        {\n\t            \"@type\": \"Person\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/person\\\/0a959ff9de7f0465a07baa1fe1ae0200\",\n\t            \"name\": \"Sang-Heon Lee\",\n\t            \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/author\\\/sang-heonlee\\\/\"\n\t        }\n\t    ]\n\t}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"RDCOMClient: Read and Write Excel, and Call VBA Macro in R","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.interactivebrokers.com\/campus\/wp-json\/wp\/v2\/posts\/197010\/","og_locale":"en_US","og_type":"article","og_title":"RDCOMClient: Read and Write Excel, and Call VBA Macro in R | IBKR Campus US","og_description":"This post gives a short introduction to the\u00a0RDCOMClient\u00a0R package, which provides a variety of functionalities","og_url":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/rdcomclient-read-and-write-excel-and-call-vba-macro-in-r\/","og_site_name":"IBKR Campus US","article_published_time":"2023-10-02T15:18:35+00:00","og_image":[{"width":1000,"height":563,"url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/08\/r-programming-coffee-laptop-desk.jpg","type":"image\/jpeg"}],"author":"Sang-Heon Lee","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Sang-Heon Lee","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"NewsArticle","@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/rdcomclient-read-and-write-excel-and-call-vba-macro-in-r\/#article","isPartOf":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/rdcomclient-read-and-write-excel-and-call-vba-macro-in-r\/"},"author":{"name":"Sang-Heon Lee","@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/person\/0a959ff9de7f0465a07baa1fe1ae0200"},"headline":"RDCOMClient: Read and Write Excel, and Call VBA Macro in R","datePublished":"2023-10-02T15:18:35+00:00","mainEntityOfPage":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/rdcomclient-read-and-write-excel-and-call-vba-macro-in-r\/"},"wordCount":374,"commentCount":0,"publisher":{"@id":"https:\/\/ibkrcampus.com\/campus\/#organization"},"image":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/rdcomclient-read-and-write-excel-and-call-vba-macro-in-r\/#primaryimage"},"thumbnailUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/08\/r-programming-coffee-laptop-desk.jpg","keywords":["Data Science","Excel","R","RDCOMClient","rstats","VBA"],"articleSection":["Data Science","Programming Languages","Quant","Quant Development","R Development"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/rdcomclient-read-and-write-excel-and-call-vba-macro-in-r\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/rdcomclient-read-and-write-excel-and-call-vba-macro-in-r\/","url":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/rdcomclient-read-and-write-excel-and-call-vba-macro-in-r\/","name":"RDCOMClient: Read and Write Excel, and Call VBA Macro in R | IBKR Campus US","isPartOf":{"@id":"https:\/\/ibkrcampus.com\/campus\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/rdcomclient-read-and-write-excel-and-call-vba-macro-in-r\/#primaryimage"},"image":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/rdcomclient-read-and-write-excel-and-call-vba-macro-in-r\/#primaryimage"},"thumbnailUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/08\/r-programming-coffee-laptop-desk.jpg","datePublished":"2023-10-02T15:18:35+00:00","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/rdcomclient-read-and-write-excel-and-call-vba-macro-in-r\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/rdcomclient-read-and-write-excel-and-call-vba-macro-in-r\/#primaryimage","url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/08\/r-programming-coffee-laptop-desk.jpg","contentUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/08\/r-programming-coffee-laptop-desk.jpg","width":1000,"height":563,"caption":"Quant"},{"@type":"WebSite","@id":"https:\/\/ibkrcampus.com\/campus\/#website","url":"https:\/\/ibkrcampus.com\/campus\/","name":"IBKR Campus US","description":"Financial Education from Interactive Brokers","publisher":{"@id":"https:\/\/ibkrcampus.com\/campus\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ibkrcampus.com\/campus\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/ibkrcampus.com\/campus\/#organization","name":"Interactive Brokers","alternateName":"IBKR","url":"https:\/\/ibkrcampus.com\/campus\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/logo\/image\/","url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/ibkr-campus-logo.jpg","contentUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/ibkr-campus-logo.jpg","width":669,"height":669,"caption":"Interactive Brokers"},"image":{"@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/logo\/image\/"},"publishingPrinciples":"https:\/\/www.interactivebrokers.com\/campus\/about-ibkr-campus\/","ethicsPolicy":"https:\/\/www.interactivebrokers.com\/campus\/cyber-security-notice\/"},{"@type":"Person","@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/person\/0a959ff9de7f0465a07baa1fe1ae0200","name":"Sang-Heon Lee","url":"https:\/\/www.interactivebrokers.com\/campus\/author\/sang-heonlee\/"}]}},"jetpack_featured_media_url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/08\/r-programming-coffee-laptop-desk.jpg","_links":{"self":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/posts\/197010","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/users\/662"}],"replies":[{"embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/comments?post=197010"}],"version-history":[{"count":0,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/posts\/197010\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/media\/194443"}],"wp:attachment":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/media?parent=197010"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/categories?post=197010"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/tags?post=197010"},{"taxonomy":"contributors-categories","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/contributors-categories?post=197010"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}