One Star

Retrieving excel file (XLS) over HTTP on different platforms

Hi All,
I have a webserver that has 3 excel files and 2 csv files. For my current job, I need to download one of the excel files to process it. Ideally I'd like to prompt for the file name but I am currently using a global variable.
The other problem is that this job must be run in two environments: once on a linux machine and once on windows.
The reason this is an issue is that normally I would setup a tFileFetch to download the excel locally but then the path is constrained to the machine I built it on. Is there a working directory talend can use regardless of where it's run? How can I setup talend to pull a csv/xls from a http URL and process it regardless of what platform is run on?
Thank you so much for the assistance.
3 REPLIES
One Star

Re: Retrieving excel file (XLS) over HTTP on different platforms

Hi, I was able to figure it out by myself.
For those who find this later on: I created a tFileFetch object pointing to the file and checked the option "Use cache to save the resources"
from there I did "onSubJobOK" to a tFileInputExcel
for the file path in the tFileInputExcel I put: ((java.io.InputStream)globalMap.get("tFileFetch_1_INPUT_STREAM"))
The file path step above is the key to the whole thing.
Hope this helps someone
One Star

Re: Retrieving excel file (XLS) over HTTP on different platforms

I'm not totally sure about your problem, but perhaps it is helpful to use contexts, where you can define a single context.FILELOC in the jobs as path. For Windows, this context.FILELOC may be defined as the path C:/TEMP/JOBFILES/ and in a UNIX/Linux environment: opt/JOBFILES/ as path (just as an example). When exporting the job to your Windows machines, you could select the WINDOWS context, so the files will be stored in the C:\TEMP\JOBFILES directory. When exporting it to the UNIX/Linux machines, you could select the UNIX context, so the files will be stored in the /OPT/JOBFILES directory.
Defining the contexts can be done in the Contexts tab --> Values as table --> Configure Contexts... (small icon)
One Star

Re: Retrieving excel file (XLS) over HTTP on different platforms

Hi joesmith123,
I am trying to get also xls from a website and I saw you did also some simular work. I have no idea how to begin with, could you be so kind and help me with that?
Best regards
Chris