rxNorm Drug API: The Daily REST library entry for Excel and GAScript

Get rxNorm drug data into Excel and Google Apps Script

Aside from being a little specialized, today’s API is another quite unusual one. Normally apis allow you select the format of the output through a URI parameter, but
http://rxnav.nlm.nih.gov/RxNormAPI.html needs you specify it in the GET headers of your request. More about that later.  This a single query API, populating multiple rows in a spreadsheet based on a query you provide. You just name the columns to match any data you want to retrieve and go. Here’s the results of query on the drug Amoxil. This example can be found in the cDataSet.xlsm and downloaded from here


Requesting the format in the xmlHttp header

These are the changes that were made in the code to support the need to specify the output format in the header.This API requires that the output format is specified in the header through the accept parameter. The code looks like this. The full code for the updated cBrowser class can be found here.

The equivalent update for Google Apps Script is

Where accept has been set in the library entry. The full code for the restLibrary is here.
And the execution code looks like this

and for Google apps script

The rest library is itself implemented as REST API and can be queried like this.
For more stuff like this, visit the ramblings site or the associated blog. If you have suggestion for particular API or contact me on our forum
About brucemcp 223 Articles
I am a Google Developer Expert and decided to investigate Google Apps Script in my spare time. The more I investigated the more content I created so this site is extremely rich. Now, in 2019, a lot of things have disappeared or don’t work anymore due to Google having retired some stuff. I am however leaving things as is and where I came across some deprecated stuff, I have indicated it. I decided to write a book about it and to also create videos to teach developers who want to learn Google Apps Script. If you find the material contained in this site useful, you can support me by buying my books and or videos.

Be the first to comment

Leave a Reply

Your email address will not be published.


eleven − 7 =