I am trying to reproduce some Excel-VBA macros in OnlyOffice-JavaScript macro builder, particularly to communicate with databases, such as MS SQL or PostgreSQL, in order to retrieve the data from there and then process it in the OnlyOffice spreadsheet editor.
In the Visual Studio IDE it is achieved by uploading the modules or classes with statements like following:
const Client = require('pg').Client;
or
const sql = require('mssql');
And everything works fine, the required data are retrieved.
However, when trying to run the same code within the OnlyOffice macro editor (in Spreadsheet editor), the errors occur one by one (ex. Error: Module name “mssql” has not been loaded yet for context: _. Use require([])) no matter which module I am trying to load and which way I am doing that. Even statements like that below run into errors (“module is not defined”).
require(['module1', 'module2'], function(module1, module2) {
// Do something after module1 and module2 are loaded
});
Hence it seems that either there is another solution for loading modules or there are no possibilities to upload external modules.
Is it possible to use modules with the require statement within macros? And if so, could you please provide some working examples with modules like ‘pg’, ‘mssql’ or ‘tedious’?