Creating a Pipeline that reads the spreadsheet and return data within

Hi,

I am Database Administrator/Developer and i am pretty new to snaplogic and i am self learning it at a moment.I got quick question on how to develop a snaplogic.
Query :- would like to add some javascript to the HTML file (either directly or with a linked script file) that will, on load and every 5 minutes, call a pipeline and update the HTML elements with the returned data. Need to build the pipeline such that it reads the spreadsheet and returns the data within.

If someone can help me at starting point. Any help will be appreciated .

Thanks
Nihil

Hi Nihil,

Welcome to the community and feel free to reach out anytime.

One of our engineers wrote up a demo application that might be a good jumping off point. In the demo, a static web page calls an ultra/trigger task with some data and updates the page with the response. This sounds pretty close to what you’d like to achieve. Try it out and let me know if you have any follow up questions.

https://docs-snaplogic.atlassian.net/wiki/spaces/SD/pages/807600247/Creating+Web+Applications+Using+SnapLogic+API+Tutorial

Best,
Tim

Thanks Tim,

I will have a go and will let you know if any follow up questions.

Thanks

Hi Tim,
Thanks for the link fro Demo application but i think i dont need ULTRA Task, I need simple Triggered task
if i say in simple terms i need something that read the data from spreadsheet and returns data within please find attached two file i am working on. I am still trying to work from your demo application to see if i can use some of it to create my pipeline.

But if you could helpe me in the mean time that would be great
Demo Display Board.zip (6.4 KB)

Hey Nihil,

I went ahead and tried to tailor an example that was closer to your use case. Try and follow these steps to get going.

  1. Import the attached project to your org. Inside is the spreadsheet file, a pipeline that can read the file, and a triggered task for the pipeline. This is what will be used to feed data to your display board demo.

  2. Navigate to the imported project and view the Task details in manager. Copy the cloud url and the bearer token into the updated HTML I attached. Look for the variables TASK_URL and TOKEN.

  1. Configure your org’s CORS settings to allow accessing the triggered task from the domain that your display board is hosted on.

  2. Load the HTML page in a browser, you should see an alert pop up with the data from the spreadsheet.

Updated HTML: Demo Display Board.zip (8.6 KB)
Project to Import: projects_Spreadsheet-Example.zip (8.2 KB)

Thanks Tim,

Much Appriciated for your help… Thanks I can go ahead and build whole pipeline.

Thanks
Regards
Nihil

Hi Tim,

Sorry to bother you again. I am getting Authentication required error when i enable Trigger task. is it because of the CORS setting as i dont have it on Snaplogic manager, is it because i dont have enough rights ?

please find attached Error screenshot and also Script. if you can reply that would be great help

ThanksDemo Display Board.zip (40.2 KB)

Also, when i load HTML in browser i cant see any pop up ? is it something i am doing wrong ?

Thanks

Hi Tim,

Its sorted now thanks

1 Like

Hi Tim,

I have added some java script which read elements from Excel file to the HTML page.

For my next step i want something that if i update data in spreadsheet it should reflect changes on HTML file? I have also added function that refresh webpage every 5 sec, but can’t figure out to refresh Triggred URL in HTML file so it pulls Excel file if some changes are been made ?

if you can help me that would be great.

Please find attached Demo Display Board.zip (7.3 KB)
Thanks

From your description I think things are looking good. The JavaScript you’ve written will now poll the triggered task every 8 seconds and when that happens the pipeline will read the file and send back the results. The JavaScript will then update the contents of the page with the new results.

Attached is a screen capture where I re-upload a new spreadsheet that changed some of the values, like the manager to Mickey Mouse, and see the change on the page. Maybe the file wasn’t uploaded or the file name was changed?

Hi Tim,

Thanks for the quick reply. its working when we re-upload excel sheet.

I want something like that i dont want to re-upload excel sheet, Say if excel sheet is opened and some make changes and save excel sheet it should directly update data on HTML…

Hope you unserstood what i meant.

Looking forward to hear from you.

Thanks
Regards
Nihil

I see, sorry for the misunderstanding. If you’d like it to pick up on the excel sheet changes, then the person editing the sheet and the pipeline will both need access to the file. Is the file located on a shared drive or server that the Plex has access to?

For example, if it’s a Groundplex and the sheet is located on a shared drive, then you could change the File Reader snap to use that location. The File Reader snap can use many different protocols to read and write files, see the documentation to see if any of those options would work for you.

If you’re using a Cloudplex, then you’d either need to make changes locally and upload to a cloud storage or maybe consider using a cloud based spreadsheet service like Google docs or Office live.

Hope that helps give you some ideas on how you can accomplish this next step.

Best,
Tim