Function Spill Not Working For Custom Functions

Luiz Hemerly 26 Reputation points
2022-09-08T17:54:15.097+00:00

Testing a simple "Split" function in an Excel on Microsoft 365 Apps:

/**  
 * @customfunction  
 */  
 async function split(text, separator) {  
  return [text.split(separator)];  
}  

But the function keeps returning a #VALUE error.
The function:

/**  
 * @customfunction  
 */  
 async function test(text) {  
  return text;  
}  

Returns correctly, the function:

/**  
 * @customfunction  
 */  
 async function test(text) {  
  return [text,text][text,text];  
}  

Returns zero.

What am I doing wrong here?

JavaScript API
JavaScript API
An Office service that supports add-ins to interact with objects in Office client applications.
983 questions
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,919 questions
0 comments No comments
{count} votes

Accepted answer
  1. Haijia_MSFT 76 Reputation points Microsoft Employee
    2022-10-11T03:09:18.193+00:00

    Hi @Luiz Hemerly ,
    You can try this,

     /**  
     * @customfunction  
     * @returns {string[][]} A dynamic array with multiple results.  
     */  
     async function split(text, separator) {  
      return [text.split(separator)];  
     }  
    

    Here is a doc for your reference.
    Thanks!


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.