Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.
Azure Mobile Services - Importing data from Excel
|Line 102:||Line 102:|
== Summary ==
== Summary ==
Revision as of 22:45, 18 June 2013
In this article will be shown how to import data from an Excel file into Azure Mobile Services in order to be used by your App. It's assumed you have created your own service else follow this guide on how to manage Azure Mobile Services.
In order to import data from your local database or Excel file you need to install last version of Microsoft SQL Server Management Studio Express (SSMSE), a free and easy graphical tool to use for managing SQL Server database with Advanced Services.
First step, in order to avoid connection issues is to set Firewall Rules to allow your IP address to connect to DB.
Microsoft SQL Server Management Studio
Opening Microsoft SQL Server Management Studio will be asked to connect to a server.
Select the server name you choosed during creation of your Mobile Service and select SQL Server Authentication option.
Once logged you can browse your remote databases, tables and perform queries.
Now we need to access to a local resourse in order to upload data from local to Cloud. To do that click on connect button on top left of the explore object column and select database engine. Will be shown the same window at startup and select your local address ( tipically localhost or network path ) and select Windows authentication.
if don't have one create a new local database
Right click on your local database -> task -> import data
Opened the import / export wizard, select Microsoft Excel as data origin and the right version of your Excel file
The next step is to select the destination server and of course will be our remote Azure Db
Now you will be able to see the content of your Excel file. Note that each sheet will be seen as a table
Selected the sheet you want to import let's click on Modify Mapping and then on Modify SQL Code
Add the following line [id] int identity primary key, into the script. This will be our primary key. Remeber that each table must have a primary key named Id. The code should look like that:
CREATE TABLE [dbo].['TABLE - NAME$'] (
[id] int identity primary key,
Now data are imported into Db and your expectation is to find tables also into your Mobile Service, but checking you still will not find them, You need to perform other operation to link your Mobile Service with your Database. To do that, go into SQL Database section, select your Database ( nokiadeveloepr_db for our tutorial ), open the Dashboard section and click on Manage
The Database Management Portal will be opened