Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass Cell References Instead of Values in Custom Functions #3018

Open
1 task done
Git-GT opened this issue Nov 23, 2024 · 1 comment
Open
1 task done

Pass Cell References Instead of Values in Custom Functions #3018

Git-GT opened this issue Nov 23, 2024 · 1 comment
Labels
feature request Issues that request new features to be added to OnlyOffice

Comments

@Git-GT
Copy link

Git-GT commented Nov 23, 2024

This issue is unique.

  • I have used the search tool and did not find an issue describing my idea.

Your idea.

Currently, when using custom functions in OnlyOffice, the arguments are passed as their corresponding values.
It would be highly useful if the function could receive the actual cell references (e.g., the row and column information) in addition to the values.

This would allow developers to create more robust and context-aware functions, such as validating data ranges before performing calculations.

Example:
If I define the custom function =MY_FUNCT(A1:A5, B1:B5):

Current behavior: The function receives only the values in the ranges A1:A5 and B1:B5.
Requested behavior: The function also receives metadata, such as { range: "A1:A5", startRow: 0, endRow: 4, startCol: 0, endCol: 0, values: [...] }.

With this enhancement, the function could validate the inputs before performing calculations.

For example:

Api.addCustomFunction("MY_FUNCT", function(range1, range2) {
    // Validate that both ranges start and end on the same rows
    if (range1.startRow !== range2.startRow || range1.endRow !== range2.endRow) {
        return "Error: Ranges must start and end on the same row.";
    }
    // Perform the calculation
    return range1.values.map((val, index) => val + range2.values[index]);
});

Calling =MY_FUNCT(A1:A5, B1:B6) would then return:

"Error: Ranges must start and end on the same row."

Thank you for considering this enhancement!

@lemonowl
Copy link

lemonowl commented Nov 29, 2024

Hi, @Git-GT
A bug has been issued #71904

@Rita-Bubnova Rita-Bubnova added the feature request Issues that request new features to be added to OnlyOffice label Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Issues that request new features to be added to OnlyOffice
Projects
None yet
Development

No branches or pull requests

4 participants