问题描述
${file} normalised Path _downloads
{Filename} get file name important file xlsx true
Open Excel Document ${file}/${filename} importantfile
${Sheet1} Get Sheet review
${Exceldata} create list
For ${row} IN @{sheetvalues}
Continue for loop if ${row}[0]=='date'
Append to list ${exceldata} ${row}
END
这仅给出一张纸的价值。如何获取多张纸的数据
解决方法
解决方案很简单。
1 /第一步是安装库:
$ pip install robotframework-excellib
https://pypi.org/project/robotframework-excellib/
还有另一个ExcelLibrary,但是Python 3.x不支持此one。
2 /创建一个示例测试用例:
*** Settings ***
Library ExcelLibrary
*** Test Cases ***
Read Excel
Open Excel Document test.xlsx doc_id=test
${value}= Read Excel Cell 1 1 List2
Log To Console ${value}
此处的要点是先打开Excel文档,然后从特定工作表中读取单元格值。您想要的工作表已指定为Read Excel Cell
中的第三个参数。
所有内容都有据可查:https://rawgit.com/peterservice-rnd/robotframework-excellib/master/docs/ExcelLibrary.html