Connect to WebAPI from Excel

Recently I coded a WebAPI endpoint to support a JavaScript application.   A power user asked “How can I view this data with Excel”?    Given how the default format is JSON we didn’t see an immediate option.

However, with a little homework we found a way to set XML before JSON and give a default XML format that is compatible with Excel data connections.

Check out the below 5 minute video and code snippet to see how.

Cheers!   shades_smile

 

Code

//default XML 
config.Formatters.Clear();
config.Formatters.Add(new System.Net.Http.Formatting.XmlMediaTypeFormatter());
config.Formatters.Add(new System.Net.Http.Formatting.JsonMediaTypeFormatter());

 

Video

WebAPI data connection to Excel from Jeff Jones on Vimeo

Return to Top ▲Return to Top ▲