How to use invoke power shell to run python script which need a parameter

Hello everybody,

The following are the details of my codes, is there anyone could help me ? Thanks in advance!


-- coding: UTF-8 --

import pandas as pd #invoke pandas sort the excel
from openpyxl import load_workbook #Access excel workbook
import datetime #Custom Date Format in excel
import sys

def sort_by_po(unfinishedExcelPath):
file = pd.DataFrame(pd.read_excel(unfinishedExcelPath))
book = load_workbook(unfinishedExcelPath)
writer = pd.ExcelWriter(unfinishedExcelPath,
engine=‘openpyxl’) = book
writer.sheets = dict((ws.title, ws) for ws in book.worksheets)
file.sort_values(by=[‘PO’,‘Item’,‘Delivery Date’],ascending=[True,True,True], inplace=True)
file.to_excel(writer, sheet_name=‘Sheet1’, index=False)
file = load_workbook(unfinishedExcelPath)
ws =
for i in range(2,ws.max_row+1):
new_value = ws.cell(row=i,column=6).value.strftime(‘%Y-%m-%d’)
ws.cell(row=i, column=6,value=new_value)

if name == ‘main’:

Hi @yu.xingxing,
I know that it might be something obvious and I’m not sure if this applicable to your case but remember that indexes usually starts from number “0”. The error you have is telling something about out of index range. Maybe that’s the case here.