Skip to main content

How To: Automate MS Excel



MS Excel, sometimes we got some task which is time taking and require good manual effort. To automate these kind of task and making our life easy there are two ways -

1) Macro - MS Excel provide Macros functionality to automate tasks in Excel. We can record our steps ( go to 'View' tab then Record Macro) then run this recorded Macro to perform the same task again. It will be good if you know VB Scripting to write general algorithm Macros.

2) Python - Python has excel API xlrd and xlwt for reading and writing Excel documents. Python is easy to use and you can code easily as compare to VB Scripting. With Python Excel API we can easily automate the excel task.

I) Setup the environment -
  1. Download Eclipse  - Eclipse is a Intergrated Development Environment in which we can easily write code.
  2. Download Python.
  3. Download Python Excel API.
  4. Open Eclipse - then go to Help menu bar - then Eclipse Marketplace
  5. Search pydev and install the Pydev - Python IDE for Eclipse 
  6. After installing the Pydev go to Windows menu bar - then Preferences 
  7. In left side of active window you will find Pydev - then Interpreter Python
          
     7.  Click on New button .
          

     8. Type Interpreter Name as  Python  and click on Browse to navigate to python.exe in your
         system python installation directory.
     9. Click on OK - this will add the python libraries.
       
 
   10.  Click on OK and you successfully configure the Python in Eclipse IDE.


II) Setup the Python Excel API in Python

        1)  Extract both the xlrd and xlwt packages into Python installation folder. In my case it is -
          
                             c:\python27\

        2)  Open command prompt and go to xlrd directory -

                              cd xlrd-0.8.0

        3)   Execute below command for installation of xlrd libraries -

                             c:\python27\python.exe  setup.py install


         4)  Go to below path for installation of xlwt libraries -

                          cd c:\python27\xlwt-0.7.4

         6)   Execute
                        
                         c:\python27\python.exe setup.py install

         7) Congratulations you successfully configured the Python Excel API.


  Here you are, ready to automate the Excel.

  For more documentation and tutorial please refer to  Python Excel API site.
 


Comments

  1. Nice Post...It actually saves a lot of time doing this way when you have some kinda work like translation where you can integrate this to Googel APIs..or reverse geocoding given a array of sheets from your boss :P

    ReplyDelete
  2. Your car might be stolen if you don't keep this in mind!

    Consider that your car was taken! When you visit the police, they inquire about a specific "VIN decoder"

    Describe a VIN decoder.

    Similar to a passport, the "VIN decoder" allows you to find out the date of the car's birth and the identity of its "parent" (manufacturing facility). You can also figure out:

    1.Type of engine

    2.Model of a car

    3.The DMV and the limitations it imposes

    4.The number of drivers in this vehicle

    You will be able to locate the car, and keeping in mind the code ensures your safety. The code can be viewed in the online database. The VIN is situated on various parts of the car to make it harder for thieves to steal, such as the first person's seat on the floor, the frame (often in trucks and SUVs), the spar, and other areas.

    What if the VIN is intentionally harmed?

    There are numerous circumstances that can result in VIN damage, but failing to have one will have unpleasant repercussions because it is illegal to intentionally harm a VIN in order to avoid going to jail or the police. You could receive a fine of up to 80,000 rubles or spend two years in prison. You might be held up on the road by a teacher.

    Conclusion.

    The VIN decoder may help to save your car from theft. But where can you check the car reality? This is why we exist– VIN decoders!

    ReplyDelete

Post a Comment

Popular posts from this blog

How To: Generating Table Report via JSON data-source in Jasper Report

Recently, I got a chance to generate reports using JSON data source in Jasper Report via Java Spring application. As I was newbie in Jasper Report; I tried to find out tutorials to get started with JSON data source and populate JSON data in table. I thought it will be smooth but its not; you need to do some configuration in JRXML to populate the data fields. In this How - To, I will try to explain how to setup JSON data source and pull data field in iReport (Jasper Report - Report Designer Tool) and then generate a table.   Note: For Java 8 users, refer this link to open iReport http://stackoverflow.com/questions/23902977/ireport-not-starting-using-jre-8 First we create static JSON file student.json: [{"name" : "ABC", "age" : 23, "address" : "11 street", "taking_hostel" : "No"},{"name" : "DEF", "age" : 22, "address" : "1 street", "taking_hostel" : &q

How to host DC hub

A DC(Direct Connect) hub is a common sharing platform to share files (audio/video/documents etc.). So , to host DC hub In Ubuntu (below 12.10) : $ sudo apt-get install opendchub After installing opendchub $ sudo opendchub Then it will ask you for port number on which DC hub will listen for user connections , so provide a port number (eg. 789 or 20103) then it will ask you for a admin link password and hub link password , so provide both passwords. Now you successfully configured the DC hub, so start the opendchub service $ sudo /etc/init.d/opendchub start and for stopping $ sudo /etc/init.d/opendchub stop Ubuntu 12.10 and other varients : You will find the open source package for opendchub , download that and then # gunzip opendchub.tar.gz # tar -xvf opendchub.tar # cd opendchub # apt-get install  libperl-dev # ./configure #make #make install # opendchub      Now the same thing it will ask you for DC hub port number to listen user connections , a