【问题标题】:Read PDF/ Excel using Robot Framework使用 Robot Framework 阅读 PDF/Excel
【发布时间】:2022-11-11 11:04:33
【问题描述】:

如何使用机器人框架读取 PDF/Excel 中的内容?

我尝试下面的代码来阅读 Excel 打开工作簿 ${EXECDIR}/Data/Documents/Gxp.xlsx 睡眠 5s $ {column1} = 获取单元格值 1 2

我收到了这个错误没有工作簿处于活动状态

有人可以帮忙吗?

【问题讨论】:

    标签: robotframework


    【解决方案1】:

    您是否安装了库 RPA 框架? 如果你没有安装你可以去这个site

    这个示例代码可以看到这个代码或者你可以访问website

    *** Settings ***
    Documentation       Read the text contained in PDF files and save it to a
    ...                 corresponding text file.
    Library             RPA.PDF
    Library             RPA.FileSystem
    *** Tasks ***
    Extract text from PDF files
    Extract text from PDF file into a text file    simple-text-example.pdf
    Extract text from PDF file into a text file    example-invoice.pdf
    *** Keywords **
    Extract text from PDF file into a text file
    [Arguments]    ${pdf_file_name}
    ${text}=    Get Text From Pdf    ${pdf_file_name}
     Create File    ${OUTPUT_DIR}${/}${pdf_file_name}.txt
     FOR    ${page}    IN    @{text.keys()}
    Append To File
    ...    ${OUTPUT_DIR}${/}${pdf_file_name}.txt
     ...    ${text[${page}]}
    END
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-03-18
      • 1970-01-01
      • 2012-11-01
      • 2021-11-25
      相关资源
      最近更新 更多