从 PowerApps 连接到云存储Connect to cloud-storage from PowerApps

PowerApps 提供多个云存储连接。PowerApps offers several cloud-storage connections. 使用其中任何一种连接,都可以存储 Excel 文件,并将其中的信息用于整个应用。Using any of these connections, you can store an Excel file and use the information in it throughout your app. 这些连接包括:These connections include:

Azure BlobAzure Blob BoxBox DropboxDropbox Google 云端硬盘Google Drive OneDriveOneDrive OneDrive
for Business
OneDrive
for Business
图标 API 图标 API 图标 API 图标 API 图标 API 图标

先决条件Prerequisites

  • 数据已格式化为表的 Excel 文件:An Excel file with the data formatted as a table:

    1. 打开 Excel 文件,然后在数据中选择要使用的任意单元格。Open the Excel file, and then select any cell in the data that you want to use.
    2. 选择插入”选项卡上的“表格”。On the Insert tab, select Table.
    3. 在“另存为表”对话框中,选中“我的表包含标题”复选框,然后选择“确定”。In the Save as Table dialog box, select the My table has headers checkbox, and then select OK.
    4. 保存所做更改。Save your changes.

连接云存储连接Connect to the cloud storage connection

  1. powerapps.com 中,展开“管理”,然后选择“连接”:At powerapps.com, expand Manage, and select Connections:

    选择“连接”

  2. 依次选择“新建连接”和云存储连接。Select New connection, and select your cloud storage connection. 例如,选择“OneDrive”。For example, select OneDrive.
  3. 此时,系统会提示你输入云存储帐户的用户名和密码。You are prompted for the user name and password of your cloud storage account. 输入用户名和密码,然后选择“登录”:Enter them, and then select Sign in:
    输入用户名和密码Enter user name and password

    登录后,即可在应用中使用此连接。Once you are signed in, this connection is ready to be used within your apps.

  4. 在应用中,单击或点击功能区“视图”选项卡上的“数据源”。In your app, click or tap Data sources on the View tab of the ribbon. 在右侧窗格中,单击或点击“添加数据源”,接着单击或点击云存储连接,然后选择 Excel 表。In the right-hand pane, click or tap Add a data source, click or tap your cloud-storage connection, and then choose the Excel table.
  5. 选择“连接”。Select Connect.

    此表会被列为数据源:The table is listed as a data source:

    选择 Excel 表

    备注

    请注意,必须将 Excel 数据格式化为表。Remember, the Excel data must be formatted as a table.

在应用中使用 Excel 数据Using the Excel data in your app

  1. 在“插入”选项卡上,依次选择“库”和“包含文本”库控件。On the Insert tab, select Gallery, and then select a With text gallery control.
  2. 将库的“Items”属性设为 Excel 表。Set the Items property of the gallery to your Excel table. 例如,如果 Excel 表名为“Table1”,请将此属性设为 Table1:For example, if your Excel table is named Table1, then set it to Table1:

    项属性

    此时,库会自动更新为包含 Excel 表中的信息。The gallery is automatically updated with information from your Excel table.

  3. 在库中,选择第二个或第三个“标签”控件。In the gallery, select the second or third Label control. 默认情况下,你会发现,第二个和第三个标签的“Text”属性自动设置为“ThisItem.something”。By default, you see the Text property of the second and third labels is automatically set to ThisItem.something. 可以将这些标签设置为表中的任意列。You can set these labels to any column in your table.

    在以下示例中,第二个标签设置为“ThisItem.Name”,第三个标签设置为“ThisItem.Notes”:In the following example, the second label is set to ThisItem.Name and the third label is set to ThisItem.Notes:

    第二个标签

    第三个标签

    示例输出:Sample output:
    第二个和第三个标签

备注

第一个框实际上是图像控件。The first box is actually an image control. 如果 Excel 表中没有图像,可以删除图像控件,然后在原处添加一个标签控件。If you don't have an image in your Excel table, then you can delete the image control, and add a label in its place. 添加和配置控件是一个好资源。Add and configure controls is a good resource.

了解表和记录介绍了更多详细信息和一些示例。Understand tables and records provides more details and some examples.

共享应用Sharing your app

可以与组织中的其他人共享应用资源(如连接器)和数据You can share your app, your resources such as connectors, and your data with others in your organization.

若要共享 Dropbox 中的文件夹,必须将共享文件夹附加到用户的 Dropbox 帐户。If you're sharing a folder in Dropbox, the shared folder must be attached to the user's Dropbox account.

涉及 Excel 文件的连接器存在某些限制There are certain limitations with connectors involving Excel files.

已知的限制Known limitations

如果尝试在应用中使用 Excel 连接时,数据类型不受支持未格式化为表,请将数据格式化为表If Data type unsupported or Not formatted as a table appears when you try to use an Excel connection in your app, format the data as a table.

如果 Excel 数据包含计算列,则无法用于生成应用,也无法将相应数据添加到现有应用中。If your Excel data includes a calculated column, you can't use it to build an app, and you can’t add that data to an existing app.

共享 Excel 表Sharing Excel tables

若要共享 Excel 文件中的数据,请执行以下操作:To share data in an Excel file:

  • 在 OneDrive for Business 中,共享文件本身。In OneDrive for Business, share the file itself.
  • 在 OneDrive 中,共享包含文件的文件夹,并指定任何介质的文件路径,而非 URL。In OneDrive, share the folder that contains the file, and specify file paths, not URLs, for any media.
  • 在 Dropbox 或 Google 云端硬盘中,共享文件或文件夹。In Dropbox or Google Drive, share either the file or the folder.

查看所有可用连接See all the available connections.
了解如何向应用添加连接数据源Learn how to add connections and add a data source to your apps.
了解表和记录(内含表数据源)。Understand tables and records with tabular data sources.
其他一些库资源包括显示项列表显示库中的图像和文本Some additional gallery resources include Show a list of items and Show images and text in a gallery.