Milcho Dimkov
04/16/2025, 9:25 AMCeligo AI
04/16/2025, 9:26 AMAI generated answer (using internal Slack threads):Yes, you can download Excel files (.xlsx) from SFTP via SuiteScript. You can use the 'N/sftp' module in SuiteScript to accomplish this. Here is a basic example of how you can use the 'N/sftp' module to download a file:
javascript
var sftp = require('N/sftp');
var file = require('N/file');
// Create connection
var connection = sftp.createConnection({
username: 'username',
passwordGuid: 'passwordGuid',
url: '<sftp://hostname>',
hostKey: 'hostKey'
});
// Download file
var downloadedFile = sftp.download({
directory: '/path/to/directory',
filename: 'filename.xlsx',
fileType: file.Type.EXCEL,
connection: connection
});
// Save file to file cabinet
var fileObj = file.create({
name: 'filename.xlsx',
fileType: file.Type.EXCEL,
content: downloadedFile,
folder: 'folderId'
});
fileObj.save();
Please replace 'username', 'passwordGuid', 'hostname', 'hostKey', 'path/to/directory', 'filename.xlsx', and 'folderId' with your actual values.
******
Disclaimer:
This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes.
******Celigo AI
04/16/2025, 9:26 AMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.825444341
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.82463932
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.824524462
Celigo AI
04/16/2025, 9:26 AM