Menu
×
   ❮   
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP C C++ C# AWS W3.CSS HOW TO BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS DSA TYPESCRIPT ANGULAR ANGULARJS GIT POSTGRESQL MONGODB ASP AI R GO KOTLIN SWIFT SASS VUE GEN AI SCIPY CYBERSECURITY DATA SCIENCE INTRO TO PROGRAMMING HTML & CSS BASH RUST TOOLS MATH

Power BI Get Data from Databases and Web


Share

Get Data from a Database

Most companies keep their important data in databases, not in files.

A database runs on a server, a computer that many people and programs connect to.

One server can hold several databases, and each database holds tables.

Power BI can connect to many kinds of databases, such as SQL Server, Oracle, MySQL and PostgreSQL.

The steps are almost the same for all of them.

This page uses SQL Server, the database from Microsoft.

Unlike a CSV file, a database table already has column names and data types.

Power BI reads them from the database, so it does not have to guess.

Note: To follow these steps, you need access to a SQL Server database, for example at work.

Ask your IT department for the server name, the database name, and how you should sign in.

If you do not have access to one, just read along.

The rest of this tutorial uses files.


Connect to SQL Server

Imagine the Poke Mart keeps its orders in a SQL Server database called PokeMart, on a server called POKEMART-SQL.

Both names are made up for this example.

  1. On the Home tab, select Get data > SQL Server. In the Get Data window, it is called SQL Server database, in the Database category.
  2. The SQL Server database dialog opens. In Server, type the server name, for example POKEMART-SQL.
  3. In Database (optional), type the database name, for example PokeMart.
  4. Under Data Connectivity mode, keep Import selected.
  5. Select OK.

The SQL Server database dialog in Power BI Desktop with a server name and a database name typed in, and Import selected under Data Connectivity mode

The fields in the dialog are:

FieldWhat to enter
ServerThe name of the server. Some servers run more than one copy of SQL Server, called instances. Then the name has the instance after a backslash, for example POKEMART-SQL\SALES.
Database (optional)The database on that server. If you leave it empty, the Navigator lists all the databases you are allowed to see.
Data Connectivity modeImport copies the data into your report. DirectQuery leaves it in the database. The next page, Import vs DirectQuery, explains the difference.
Advanced optionsExtra settings, such as a SQL statement: your own query instead of picking tables. Leave them empty unless you know SQL.

Sign In

The first time you connect to a server, Power BI asks how to sign in. The common choices are:

  • Windows: use the account you are signed in to Windows with. This is common inside a company network.
  • Database: a user name and password that are stored in SQL Server itself.
  • An organizational account (Microsoft Entra ID), if the server supports it.

Choose the method your IT department gave you, enter the details, and select Connect.

If the connection is not encrypted, Power BI tells you so and asks whether to continue without encryption.

Only continue if your IT department says it is OK.

Power BI remembers how you signed in to each server, so it asks only once.

To change or clear the saved sign-in later, select File > Options and settings > Data source settings.

Pick the Tables

The Navigator opens and lists the tables and views in the database.

In our example, it could show tables for sales, products and stores.

Select the tables you need, then select Load or Transform Data, just like with a file.

Pick only the tables you need.

A company database can have hundreds of tables and millions of rows, and with Import, all the rows you choose are copied into your report.



Get Data from a Web Page

Web pages often show data in tables: prices, results, lists.

The Web connector reads the HTML tables on a page and turns each one into a table you can load.

The Poke Mart price list is on this page:

https://www.w3schools.com/powerbi/poke_mart_prices.html

Open it in your browser first.

It shows one table with three columns: Product, Category and Price.

To load it into Power BI:

  1. On the Home tab, select Get data > Web.
  2. The From Web dialog opens. Keep Basic selected, paste the address above into the URL box, and select OK.
  3. The first time you visit a site, Power BI asks how to sign in. The page is public, so select Anonymous, then Connect.
  4. The Navigator lists the tables it found on the page. Select Table 1. The price list appears in the preview.
  5. Select Load.

If you are not sure which table holds your data, select the Web View tab in the Navigator.

It shows the page itself, with each table it found highlighted.

The loaded table has all 10 products:

ABCProductABCCategory123Price
Poke BallBalls200
Great BallBalls600
Ultra BallBalls1200
PotionMedicine300
Super PotionMedicine700
Hyper PotionMedicine1200
ReviveMedicine1500
AntidoteStatus Healers100
Paralyze HealStatus Healers200
AwakeningStatus Healers250

The prices are the same as the UnitPrice column in the sales data.

The web page has no data types, so Power BI detected them, like it does for a CSV file.

The new table is called Table 1.

Give it a better name: in the Data pane, right-click Table 1, select Rename, and type Prices.

Note: Web pages change.

If the owner of the site moves, renames or removes the table, the next refresh can fail or bring in the wrong data.

Use a web page as a source only when you trust it to stay the same.

The Web connector also reads files that are stored on a website.

If the URL points to a CSV or Excel file, Power BI opens that file instead of a page.


Other Data Sources

A few more sources you will often meet:

  • Folder: combines all the files in a folder that have the same columns, for example one CSV file for each month.
  • SharePoint folder: does the same for files in a SharePoint document library.
  • SharePoint Online List: loads a list from a SharePoint site.
  • OData Feed: loads data from web services that publish it in the OData format.
  • Power BI semantic models: reuses a model that someone has already published. See Live Connection.


Free account

Track your progress

XP earned 0 Day streak 0 Spaces 0 League —

New

Learn in Adventure Mode W3Schools Adventure App

Coding fundamentals as bite-sized lessons and challenges.

×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
sales@w3schools.com

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
help@w3schools.com

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookies and privacy policy.

Copyright 1999-2026 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.