I have created a .robot file which generates and returns an Item number (any random number) and it gets stored in a robot framework variable.e.g.
${item_number} = 123456789
I want to get that value stored in ${item_number} variable and use that in a .py file which I am using to add data in an excel sheet
#Library to import current date and time
import datetime
#Library for Excel
import openpyxl
from openpyxl import Workbook
from openpyxl import load_workbook
#Opening active excel
book = openpyxl.load_workbook('New_SO_CA.xlsx')
sheet = book.active
#Adding data to Excel Sheet
sheet['D2'] = '' #This is where I want to use the ${item_number} value
Excel sheet should get updated like the following:
Column D2 |
---|
123456789 |
Please let me know if I have missed something to add. Thanks in advance.
I have tried to look online but I only found how to manually add a value in the python file to store it in the excel sheet or to dynamically update value in robot file using python file.
harman singh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.