Exporting Excel To Remote Server

KIMYEONGSEOK asked on November 1, 2018

I need some Technical Support about exporting Excel file to remote server. 
but the thing is the excel fine generation will not be triggered by user action but programmatically.
This is how it goes, 
1.Excel Being Generated Periodically in Web Server 
2.The generated file gets posted to WAS
3.WAS handles the post request, and save the excel file to somewhere intended. 
 
Bottom line is, is it possible to generate files and trigger exporting API to remoter server AUTOMATICALLY?
 

5 answers

Public
Tanya Gryshko Flexmonster November 1, 2018

Hello!
If you want to export Excel file to remote server programmatically, the most convenient option is to use PhantomJS. It allows using Flexmonster’s exportTo API call without showing the pivot grid. Using a small script, it is possible to load a page with Flexmonster. For more details please refer to this doc: https://www.flexmonster.com/doc/export-and-print/#!phantomjs
I hope this information would be helpful.
Regards,
Tanya

Public
KIMYEONGSEOK November 2, 2018

Thanks for the reply, but it has not clearly answered my question. So to be clear, 
Is it possible to export the generated file to REMOTE SERVER? or only possible to export to the WEB SERVER’s local directory that Flexmonster Javascript is running on ?

Public
Tanya Gryshko Flexmonster November 2, 2018

Hello!
Thanks for a quick update.
Yes, the generated file can easily be exported to the remote server. Here is a sample:

var params = {
destinationType: 'server',
url: 'your server-side script'
};
flexmonster.exportTo('excel', params);

Please note that url is a path to the server-side script which can save this file.
Does it help?
Regards,
Tanya

Public
Aaron July 12, 2019

Hi there,
I don’t see anything in the documentation for exportTo that allows me to pass request headers to the url when exporting the file. Is this possible? I need to be able to securely tell the server which tenant the report belongs to when exporting it and I need to use http headers to do so.
Thanks,
Aaron

Public
Vera Didenko Flexmonster July 12, 2019

Hello, Aron,
 
Thank you for your question.
 
We would like to confirm that you can pass request headers to the URL during export via the requestHeaders parameter.
The requestHeaders property allows you to add custom request headers. This object consists of “key”: “value” pairs, where “key” is a header name and “value” is its value. 
 
For example: 

var params = {
destinationType: 'server',
url: 'your server-side script',
requestHeader: {
'Authorization':"znati 21521512454"
}
};
flexmonster.exportTo('excel', params);

 
Please let us know if you have further questions.
 
Best Regards,
Vera

Please login or Register to Submit Answer