Bỏ qua để tới nội dung chính
Đăng nhập với Microsoft
Đăng nhập hoặc tạo một tài khoản.
Xin chào,
Chọn một tài khoản khác.
Bạn có nhiều tài khoản
Chọn tài khoản bạn muốn đăng nhập.
Tiếng Anh
Chúng tôi rất tiếc. Bài viết này không có bằng ngôn ngữ của bạn.

Sometimes you need a PivotTable for data that is stored outside of Excel, like in a database. In this case, you connect to the external data source first, and then use a PivotTable to summarize, analyze, explore, and present that data.

Use an external data source to create a PivotTable

You can use an external data source, but it depends on the type of source.

If the source is a SQL Database

  1. On the Data tab, click New Database Query

  2. Click SQL Server ODBC.

  3. The Connect to SQL Server ODBC Data Source dialog box appears. Get the server information from your database administrator, and type it in this dialog box. Click Connect when you're done.

  4. On the left, click the arrow next to the server to see the databases.

  5. Click the arrow next to the database you want.

  6. Then click the name of the table you want.

  7. To get a preview of what the data will look like, click Run.

  8. When you're ready to bring the data into Excel, click Return Data.

  9. In the Import Data dialog box, click PivotTable, and then click OK.

    Excel creates an empty PivotTable and displays the PivotTable Builder. Add, remove, or move the fields as you see fit.

If the source is not a SQL Database

If you want to use an external source that is not a SQL Database, you will need an Open Database Connectivity (ODBC) driver installed on your Mac. Information on drivers is available on this web page. Once the driver for your source is installed, you can follow these steps to use the external data in a PivotTable:

  1. On the Data tab, click New Database Query

  2. Click From Database.

  3. Add the data source for your database, and then click OK.

  4. On the left, click the arrow next to the server to see the databases.

  5. Click the arrow next to the database you want.

  6. Then click the name of the table you want.

  7. To get a preview of what the data will look like, click Run.

  8. When you're ready to bring the data into Excel, click Return Data.

  9. In the Import Data dialog box, click PivotTable, and then click OK.

    Excel creates an empty PivotTable and displays the PivotTable Builder. Add, remove, or move the fields as you see fit.

See also

Create a PivotTable to analyze worksheet data

ODBC drivers that are compatible with Excel for Mac

Bạn cần thêm trợ giúp?

Bạn muốn xem các tùy chọn khác?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

Thông tin này có hữu ích không?

Điều gì ảnh hưởng đến trải nghiệm của bạn?
Khi nhấn gửi, phản hồi của bạn sẽ được sử dụng để cải thiện các sản phẩm và dịch vụ của Microsoft. Người quản trị CNTT của bạn sẽ có thể thu thập dữ liệu này. Điều khoản về quyền riêng tư.

Cảm ơn phản hồi của bạn!

×