Hey peeps,
Im fairly new to scripting. I am working on a Python script to create VLANs based on the data in a excel form.
I am not completely sure how to go about this. How would I go about pulling site names and then uploading the row of data relevant to that site name?
You can see this is a broken script. "Net name" is referencing a range of cells in colum A which contain "Site name". This actually gives a tupel error.
Create VLAN: Name, ID etc. Reference a single cell currently. (this was my test). But now i need it to reference the data in the row next to "site name"
Id appreciate any direction here. Anything i should study or thought process etc. Still new, sorry for the painfully basic question.
import meraki
import openpyxl
from openpyxl import Workbook, load_workbook
API_KEY = *****
wb = load_workbook('test-excel.xlsx')
ws = wb.active
dashboard = meraki.DashboardAPI(API_KEY)
myOrgs = dashboard.organizations.getOrganizations()
net_name = ws['A2':'A4']
for row in net_name:
net_name = row + 1
#gets and defines the ORG ID
for theOrg in myOrgs:
if theOrg['name'] == "ORG NAME":
my_org = int(theOrg['id'])
#Gets network ID from ORG and saves as variable named network_id
my_networks = dashboard.organizations.getOrganizationNetworks(my_org, total_pages='all')
for net in my_networks:
if net["name"] == net_name:
network_id = net["id"]
#Create a new VLAN from your input network
vlan = dashboard.appliance.createNetworkApplianceVlan(
network_id,
id=ws['B2'].value,
name=ws['C2'].value,
applianceIp=ws['D2'].value,
subnet=ws['E2'].value)
print("Done")