Fetching File Content for the XBRL (Other Binary File Type) using SuiteScript

The XML file will return the Original file content while using the fileObj.getContents().

XBRL files often come in Base64 encoding, and it’s common to convert them to UTF-8 for further processing.

let fileObj = file.load({ id: File_Internal_ID });
let fileContents = fileObj.getContents();
// convert data from Base64 to UTF_8
fileContents = encode.convert({
    string: fileContents,
    inputEncoding: encode.Encoding.BASE_64,
    outputEncoding: encode.Encoding.UTF_8
})

In this example, the encode.convert() method is used to convert the XBRL data from Base64 encoding to UTF-8.

Leave a comment

Your email address will not be published. Required fields are marked *