Search code examples
c#httpwindows-store-apps

Grabbing file from web site to auto sync data


I want to grab a file (Excel file) every week since the data in the Excel file keep changing. For example, Excel file for taxi cabs information. It would keep changing on the web site from where I am grabbing. Everything remains same except new data gets added occasionally. I am building a app in C# and publishing it to the store that grabs that file and saves it. From that Excel file, I am planning to create a API for example, getCabNames(), getCabNum() etc.

Since it will be an app already in the store, my code must be efficient enough to grab the file from the website and makes it auto-sync. On linux system on my local computer, I can have a script which wget <file-location-from-website> and I can cron it but since this is a app on the store, I cant use it this way.

The problem is how do I retrieve file from the website every week or so and keep updating the file so its syncd. This the website: link The file is at the bottom of the link called Taxicab Stand Locations (Excel)

What would be the most efficient way of doing this?


Solution

  • sounds like you need to make the data in excel available to your app via some sort of a web service, but you already know that since you are planning to create an API. if you know c#, look into asp.net mvc web api and create a controller which reads the excel file stored on the server and returns its data in a format your app will understand..

    here's an example of how to build a web service using asp.net mvc web api

    http://www.asp.net/web-api/overview/creating-web-apis/creating-a-web-api-that-supports-crud-operations