NexarDeveloper / nexar-supply-excel-cs

The Nexar Supply Excel Add-in
MIT License
18 stars 0 forks source link

Nexar Supply Excel Add-In

The Nexar Supply Excel Add-in enables you to access pricing and availability data from right within Microsoft Excel. You can populate part information for your BOM all at once without leaving your spreadsheet.

This Add-in is supported on the Windows platform only and the versions supported are Excel for Microsoft 365 and Excel 2016. Specifically, the versions tested were Excel for Microsoft 365 MSO (16.0.14228.20216) 64-bit and Microsoft Excel 2016 MSO (16.0.14228.20216) 32-bit.

Register at nexar.com

If you haven't done so already, you will need to register at nexar.com.

  1. Sign up for a new account for free and complete the simple registration process.
  2. Create your Organization.
  3. Create an Application ensuring you have the "Supply" scope switch enabled.
  4. Go to your Dashboard and then Manage Applications and choose Show Details to see the Client Id and Secret credentials.
  5. NB: The Client Secret is confidential and should only be used to authenticate your Application and make requests on its behalf.

Installation

  1. Download the Nexar Supply Add-in binary for your system.

  2. In Excel, choose 'File -> Options -> Add-ins', then press 'Go...' to manage the 'Excel Add-ins'.

  3. Browse for the Nexar Supply Add-in, make sure it's selected, and press 'OK'.

  4. To use the worksheet functions, simply type '=NEXAR_' and the list of functions will appear. Refer to the Excel Functions for documentation on how to use these functions.

Ribbon

A new ribbon will be added to your toolbar to make use of the new functionality.

The following table summarizes the actions of these commands.

Command Group Description
Rerun Failures Queries For MPNs which were not found or which returned an error, repeat the search again now
Force Rerun All Queries Executes all MPN queries again to refresh all the information
Update Hyperlinks Formatting Turn any results which are URLs into clickable links, or removes links from non-URLs
Refresh Login Connect to Nexar Once your session expires (24 hours) generate a new access token from client credentials
Launch nexar.com Connect to Nexar Open nexar.com in the user’s default browser

Note the "Force Rerun All" command causes all =NEXAR_... functions to run again even if the information is up to date. This results in re-executing Nexar supply API queries again with returned parts counting against your monthly part allowance.

Excel Functions

The following functions are available through the Add-in. You can also access the guide to each argument by clicking the Function Wizard (fx) after you've selected any function. Keep in mind that across most functions, the "MPN or SKU" field is required; most other fields are optional.

The first function that you'll need to call in order to use the Add-in is:

=NEXAR_SUPPLY_LOGIN("ClientId", "ClientSecret")

ClientId refers to your unique Nexar Supply application Client Id key as provided by Nexar. ClientSecret refers to your unique Nexar Supply application Client Secret key as provided by Nexar.

Once you've entered these correctly the result will read "The Nexar Supply Add-in is ready!". This login to the Nexar servers will mean your usage of supply queries from within the Add-in can be tracked and offset against your monthly quota.

Top tips for connecting:

For accessing your Nexar supply Client Id and Client Secret visit Nexar which you can do easily with the "Launch nexar.com" button.

From here on, the world is your oyster:

=NEXAR_SUPPLY_AVERAGE_PRICE(...)
=NEXAR_SUPPLY_DATASHEET_URL(...)
=NEXAR_SUPPLY_DETAIL_URL(...)
=NEXAR_SUPPLY_SHORT_DESCRIPTION(...)
=NEXAR_SUPPLY_MANUFACTURER_NAME(...)
=NEXAR_SUPPLY_DISTRIBUTOR_LEAD_TIME(...)
=NEXAR_SUPPLY_DISTRIBUTOR_MOQ(...)
=NEXAR_SUPPLY_DISTRIBUTOR_ORDER_MUTIPLE(...)
=NEXAR_SUPPLY_DISTRIBUTOR_PACKAGING(...)
=NEXAR_SUPPLY_DISTRIBUTOR_PRICE(...)
=NEXAR_SUPPLY_DISTRIBUTOR_SKU(...)
=NEXAR_SUPPLY_DISTRIBUTOR_STOCK(...)
=NEXAR_SUPPLY_DISTRIBUTOR_STOCK_UPDATED(...)
=NEXAR_SUPPLY_DISTRIBUTOR_URL(...)
=NEXAR_SUPPLY_LOGIN(...)
=NEXAR_SUPPLY_VERSION(...)

For results that come in a URL format (e.g., for =NEXAR_SUPPLY_DATASHEET_URL, =NEXAR_SUPPLY_DETAIL_URL or =NEXAR_SUPPLY_DISTRIBUTOR_URL, click the "Update Hyperlinks" button to activate the links.

Sample Spreadsheet

A sample spreadsheet, including examples of functions as well as a small (and unrealistic) Bill-of-Materials (BOM), is provided.

Building the Excel Add-in (Windows):

Required software

Generate XLL Add-in:

Debugging

Improvements