Blockly fileimport

Is it possible to import data from a file (txt or excel) using blockly?

I don’t think so, at least not with native Blocks. The easiest way I’ve found to do this in any rule language is to call executeCommandLine and cat the contents of the file.

I don’t see a block nor a block library for executeCommandLine so you could use the inline script block with something like

var Duration = Java.type('java.time.Duration');
var fileContents = actions.Exec.executeCommandLine(Duration.ofSeconds(1), 'cat', '/path/to/file');

fileContents will be a String containing the contents of the file.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.