Generally we kept all our inventory data in microsoft excel such as server ip, hostname & configuration etc. We generally do copy ip address from this excel , so that it can be pasted in putty.exe for connection. But what if don’t need to copy & paste ip details in excel, instead you just need to double click on the cell which has ip address for connection with the server. This post will guide you about how to connect to Linux server from Microsoft Excel.
Pre-requisite to connect to Linux server from Microsoft Excel
- Inventory with write access
- putty.exe
How to connect to Linux server from Microsoft Excel
1. Download the putty.
Please download putty.exe from the below links as per your architecture (32 Bit or 64 Bit)
putty.exe
(the SSH and Telnet client itself)
2. Open the excel File.
Now open the microsoft excel ie your inventory where you have kept all your server details. For demo
3. Write Macro for automating the task.
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) Shell "C:\putty.exe -ssh " & ActiveCell, 1 Cancel = True End Sub
in case your username is same for all your connection use below code so that you only need to type password in the putty window.
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) Shell "C:\putty.exe -ssh -l root " & ActiveCell, 1 Cancel = True End Sub
In above we have used root as user for connecting automatically using putty.
4. Save the file with .xltm extension.
Now Press Ctrl+s for saving the file. Save this file as “Excel macro-Enabled Template” with “.xltm” extension.
5. Double click on IP column for connection with server.
Now you are almost done to connect to Linux server from Microsoft Excel. Just double click on the cell which has ip and putty will be called automatically passing IP as an parameter.
This How we double click on ip column to connect with server.
Biju Samuel says
I was trying to use this procedure for sending a cell value to an external programe. But i am getting ‘Run-time error ‘5’ Invalid Procedure Call or Argument”. i am almost on the verge of giving up as i am not able to fix it since the past few weeks!!