Hi ,
I can give you some assistance in terms of the script not sure what commands you want to run ...This script can connect to a device via SSH,run commands in config mode or enabled mode and also write to a spreadsheet. However packages mentioned in the comments must be installed via pip into a Python 2.7 environment.
##install netmiko package into an python environment using pip to connect to network devices using SSH
##install xlwt package into a python environment using pip for spreadsheet work
from netmiko import ConnectionHandler
from xlwt import Workbook
import logging
ios_Device = {
'device_type' : 'cisco_ios',
'ip' : 'enter ip address here',
'username' : 'enter ssh username here',
'password' : 'enter ssh password here',
'secret' : 'enter secret here',
}
commands = ['enter comma separated commands here']
##example
##config_commands = [ 'int fa0/0' , 'ip address dhcp' ]
logging.basicConfig(filename='test.log', level=logging.DEBUG)
logger = logging.getLogger("netmiko")
net_connect = ConnectionHandler(**ios_Device)
##if command doesn't require device to be in configuration mode use this
output = net_connect.send_command(commands)
##if command requires configuration mode then use this
net_connect.enable()
output = net_connect.send_config_set(commands)
##print to console
print(output)
##print to workbook/spreadsheet
wb = Workbook()
sheet1 = wb.add_sheet('Sheet 1')
##write(R,C,Data to write to sheet)
sheet1.write(0,0,output)
##save the spreadsheet
wb.save('savedSpreadSheet.xls')