API for Getting and Setting Cell Value

  • Last update:April 11, 2025
  • Version

    VersionFunctional Change

    11.0

    Difference from V10.0:

    In V10.0, the following APIs are supported only in Data Entry Preview.

    getCellValue


    API

    getCellValue(sheetindex,address|row,col)

    This API should be getCellValue(sheetindex,address|col,row) in Data Entry Preview.

    To obtain the value in a specified cell. The parameter value can be either the cell address or the row and column numbers of the cell.

    Parameter

    addressstring

    colnumberrownumber

    sheetindex: sheet index number, which starts from 0. If this value is omitted, the index number of the first sheet is used by default.

    address: cell address, which is a string (for example, A1). When using a cell address, you cannot specify the sheet.

    col: cell column number, which starts from 1. In Data Entry Preview, this value starts from 0.

    row: cell row number, which starts from 1. In Data Entry Preview, this value starts from 0.

    Returned Value

    void

    Example

    Example 1: You can obtain the value in cell A1 when the obtained report block object is defined as report.

    Using the cell address:

    report.getCellValue("A1");

    Using the row and column numbers of the cell:

    report.getCellValue(1,1);

    Example 2: In Pagination Preview of a general report, you can obtain the value in cell A1 using the cell address.

    _g().getCellValue("A1");

    Example 3: In Data Entry Preview, you can obtain the value in cell A1 of the second sheet.

    _g().getCellValue(1,0,0);

    Example 4: In a dashboard, you can obtain the value in cell A1 of the report block named report0 using the cell address.

    _g().getWidgetByName('report0').getCellValue("A1");


    Application Example

    You can click the button to obtain the value in cell B1.

    For details, you can download the template Obtaining the Cell Value.cpt.

    Screen Recording 2025-04-11 at 14.23.39 (1).gif

    Mobile Terminal

    This API is supported only in Pagination Preview of a general report.

    setCellValue


    API

    setCellValue(sheetindex,address,value|row,col,value)

    iconNote:
    This API should be setCellValue(sheetindex,col,row,value) in Data Entry Preview.

    To assign a value to a specified cell. The parameter value can be either the cell address or the row and column numbers of the cell.

    Parameter

    address: string

    col: number

    row: number

    value: string

    sheetindex: sheet index number, which starts from 0. If this value is omitted, the index number of the first sheet is used by default.

    address: cell address, which is a string (for example, A1). When using a cell address, you cannot specify the sheet.

    col: cell column number, which starts from 1. In Data Entry Preview, this value starts from 0.

    row: cell row number, which starts from 1. In Data Entry Preview, this value starts from 0.

    value: value to be assigned to the specified cell, which is a string.

    Returned Value

    void

    Example

    Example 1: You can assign the value Order Number to cell A1 when the obtained report block object is defined as report.

    Using the cell address:

    report.setCellValue("A1","Order Number");

    Using the row and column numbers of the cell:

    report.setCellValue(1,1,"Order Number");

    Example 2: In Pagination Preview of a general report, you can assign the value Order Number to cell A1.

    _g().setCellValue("A1","Order Number");

    Example 3: In Data Entry Preview, you can assign the value Order Number to cell A1 of the second sheet.

    _g().setCellValue(1,0,0,"Order Number");

    Example 4: In a dashboard, you can assign the value Order Number to cell A1 of the report block named report0.

    _g().getWidgetByName('report0').setCellValue("A1","Order Number");


    Application Example

    You can click the button to assign the value Order Number to cell A1.

    For details, you can download the template Modifying the Cell Value.cpt.

    Screen Recording 2025-04-11 at 14.24.00 (1).gif

    Mobile Terminal

    This API is supported only in Data Entry Preview of a general report.



    Attachment List


    Theme: Rachel
    Already the First
    • Helpful
    • Not helpful
    • Only read

    滑鼠選中內容,快速回饋問題

    滑鼠選中存在疑惑的內容,即可快速回饋問題,我們將會跟進處理。

    不再提示

    9s后關閉

    Get
    Help
    Online Support
    Professional technical support is provided to quickly help you solve problems.
    Online support is available from 9:00-12:00 and 13:30-17:30 on weekdays.
    Page Feedback
    You can provide suggestions and feedback for the current web page.
    Pre-Sales Consultation
    Business Consultation
    Business: international@fanruan.com
    Support: support@fanruan.com
    Page Feedback
    *Problem Type
    Cannot be empty
    Problem Description
    0/1000
    Cannot be empty

    Submitted successfully

    Network busy