Click here to Skip to main content
Click here to Skip to main content
Go to top

How to Check Whether Excel is Installed in the System or Not

, 7 Nov 2013
Rate this:
Please Sign up or sign in to vote.
Here we will explore the trick to verify whether Excel is installed in the client's system or not by C#.

Introduction

If you are using Microsoft.Office.Interop.Excel for Excel related operations in your application, then you must check if Excel is installed in the client machine or not. This tip gives you that trick.

Background

This little piece of code is a result of the research during development of one Windows Utility, which uploads Excel sheets to database.

Using the Code

We will use Type Class and its method Type.GetTypeFromProgID Method (String).

Gets the type associated with the specified program identifier (ProgID), returning null if an error is encountered while loading the Type.

Return Value

Type: System.Type
The type associated with the specified ProgID, if progID is a valid entry in the registry and a type is associated with it; otherwise, null.

For Excel, the ProgID is Excel.Application. So, the below code is used to check whether Excel is installed or not.

Type officeType = Type.GetTypeFromProgID("Excel.Application");

if (officeType == null)
{
    // Excel is not installed.
    // Show message or alert that Excel is not installed.
}
else
{
    // Excel is installed.
    // Continue your work.
}

History

  • 07 November 2013 - First version submitted for approval

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Tadit Dash (ତଡିତ୍ କୁମାର ଦାଶ)
Software Developer Mindfire Solutions
India India
Proud Indian | Microsoft MVP | CodeProject MVP | Author | Blogger | Community Expert | Moderator | jsfiddler | Cricketer | Cook | Dancer
 
Currently working @Mindfire Solutions.
Love to code and help guys to Trap the Bug.

My Tech Blog

taditdash.wordpress.com

Programming Community Profiles

jsfiddle | Stack Overflow

Other Blog Profiles

Mindfire CRM Team Blog | Mindfire Blog

Social Profiles

Facebook | Twitter | LinkedIn | Google+

Awards

  1. Microsoft MVP 2014
  2. Code Project MVP 2014
  3. Star Achiever of the Month December 2013
  4. Mindfire Techno Idea Contest 2013 Winner
  5. Star of the Month July 2013
Follow on   Twitter   Google+   LinkedIn

Comments and Discussions

 
QuestionCheck if Excell installed is 64 bit or 32 Bit Pinmemberthangtx17-Mar-14 1:24 
AnswerRe: Check if Excell installed is 64 bit or 32 Bit PinprotectorTadit Dash20-Mar-14 19:18 
QuestionWhich Excel version(s) is installed? PinmemberDennis M Wallentin11-Nov-13 2:49 
AnswerRe: Which Excel version(s) is installed? PinprofessionalTadit Dash11-Nov-13 3:41 
AnswerRe: Which Excel version(s) is installed? PinmemberMadJohn11-Nov-13 17:47 
AnswerRe: Which Excel version(s) is installed? PinprofessionalTadit Dash11-Nov-13 19:02 
GeneralMy Vote of 4 PinmemberPatil Kishor7-Nov-13 12:58 
GeneralRe: My Vote of 4 PinprofessionalTadit Dash7-Nov-13 19:24 
GeneralMy vote of 4 PinprofessionalMarco Bertschi7-Nov-13 5:50 
AnswerRe: My vote of 4 PinprofessionalTadit Dash7-Nov-13 6:24 
AnswerRe: My vote of 4 PinprofessionalTadit Dash29-Nov-13 4:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web02 | 2.8.140926.1 | Last Updated 7 Nov 2013
Article Copyright 2013 by Tadit Dash (ତଡିତ୍ କୁମାର ଦାଶ)
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid