Quantcast
Channel: UiPath Community Forum - Topics tagged error
Viewing all articles
Browse latest Browse all 4384

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

$
0
0

Hello everybody,

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

#!/usr/bin/python

-- 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’)
writer.book = 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)
writer.save()
file = load_workbook(unfinishedExcelPath)
ws = file.active
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)
file.save(unfinishedExcelPath)

if name == ‘main’:
sort_by_po(sys.argv[1])

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 4384

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>