I am trying to build an ARIS report that will read and write to Excel files on a shared drive. I've tried mapping these shared drives on the ARIS server. Both the read and write reports will automatically run on a nightly basis, so this is not a report where I can have the user select the Excel file that they are using.
For instance, I mapped one to the Z drive and then tried the following:
var filePath = "Z:\\ExcelImportFile.xlsx";
var file = new java.io.File(filePath);
var fileStream = new java.io.FileInputStream(file);
var bytes = java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, file.length());
fileStream.read(bytes);
fileStream.close();
return bytes;
It says that it cannot find the path specified.
I've also tried the actual name of the remote server i.e. "\\\\us-shared-drive\\ExcelImportFile.xlsx"
I have seen quite a few options online for reading a file from a shared drive and including credentials, but they all require Java packages that are not included in the API.
Has anyone done something similar? Is there a way to do this in ARIS that can allow me to pass the credentials needed for the shared drive? What am I missing/
Hi Robert - Thanks for your reply. I can use scriptrunner if I'm running it nightly, but we also want users to be able to execute the import/export on the fly. I don't think there's any way to kick off a bat file via an ARIS report because of the same predicament.
Hi Robert - Thanks for your reply. I can use scriptrunner if I'm running it nightly, but we also want users to be able to execute the import/export on the fly. I don't think there's any way to kick off a bat file via an ARIS report because of the same predicament.
Hi Ellen,
Did you check the Aris server has read/write privileges on your share drive? Don't forget the script is running from the Aris Server and not from your computer, so appropriate rights have to be defined on the server side.
Best Regards.
Romain Tricarico
Hi Tricarico -
I personally can map the drive and read/write to it (my username has access). But since the ARIS service is running as the local system, I'm unsure how to give the server itself access. I've tried switching the ARIS service to run as a service account rather than the local system, but after that change, the postgresECP runnable fails.
- Ellen
Update - I've asked to have the actual servername have permission to read/write to the group. Rather than the mapped path, which would only be used for my profile, I am trying to pull the file from the shared drive name:
var filePath = "\\\\server-domain-name\\shared-folder\\excel-file.xlsx";
Still no luck - it does not find the file path when I run the report.
Hello
I remember that ARIS Service (on server side) has to be started using domain user which has privileges to read/write on specified network path.
So check if ARIS Service is started using such user
If yes - script can use following method to get specified file
'\\\\server\folder\file.ext'
Best Regards
Szymon Sobkowiak
Hello
May be this can help you:
function getFileFromFolder( filePath ) {
var file = new java.io.File(filePath);
var fileStream = new java.io.FileInputStream(file);
var bytes = java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, file.length());
fileStream.read(bytes);
fileStream.close();
return bytes;
}
function main() {
var importFile = getFileFromFolder( "C://TEMP//1.xlsx" );
if (importFile != null) {
var workbook = Context.getExcelReader(importFile);
var workSheet = workbook.getSheets();
var word_1 = workSheet[0].cell( 0, 0 ).getCellValue();
var word_2 = workSheet[0].cell( 0, 1 ).getCellValue();
Dialogs.MsgBox("Dialog_2:" + word_1 + word_2);
}
}