Power Apps Data Table – Complete tutorial

In this Power Apps Tutorial, We will discuss what is Power Apps Data Table control, What are the Data table properties, and how we can use it in PowerApps.

Also, by taking some simple scenarios, We will cover all these below topics:

  • PowerApps Data Table Control
  • PowerApps Data Table Properties
  • Availability and Nonavailabilty in PowerApps Data Table
  • Issues in PowerApps Data Table
  • PowerApps data table limit
  • Add a Data Table in PowerApps
  • PowerApps data table filter
  • PowerApps data table select row
  • PowerApps data table vs gallery
  • PowerApps data table hyperlink
  • PowerApps data table wrap text
  • PowerApps data table conditional formatting
  • PowerApps data table filter and sort
  • PowerApps data table add custom column
  • PowerApps data table add button
  • PowerApps data table alternate row color
  • PowerApps filter data table based on dropdown
  • PowerApps data table sort by column
  • PowerApps data table group by
  • PowerApps datatable checkbox
  • PowerApps data table distinct
  • PowerApps data table delete row
  • PowerApps data table date format
  • PowerApps data table default select row
  • PowerApps data table empty
  • PowerApps data table functions
  • PowerApps data table grid lines
  • PowerApps data table hide column
  • PowerApps data table total row
  • PowerApps data table sharepoint list
  • PowerApps data table on select
  • PowerApps data table sum column
  • PowerApps Data Table Export

Power Apps Data Table Control

  • PowerApps Data Table is a type of control that helps to display a bunch of data in a tabular format. The data table contains a Header for each field that the control displays.
  • Similarly to the PowerApps Gallery Control, the Data table control contains the Selected property that directs to the selected row. Also, you can link the data table control to other controls.

Power Apps Data Table Properties

Below represents some of the important key properties of the Power Apps Data Table control.

  1. Items = It defines the source of data that appears in the Data table control.
  2. Selected = It specifies the selected row in the Data table control.
  3. AutoWidth = It specifies the property of a column inside a data table to define if the column width should be automatic, or manual.
  4. BorderColor = It defines the color of the Data table control’s border.
  5. Color = It defines the default text color for all data rows.
  6. FieldDisplayName = It defines the property of a column inside a data table that defines display name for the selected column.
  7. Fill = It represents the default background color for all data rows.
  8. HeadingColor = It specifies the text color for the column headings.
  9. HeadingFill = This specifies the background color of the column headings.
  10. HeadingFont = It defines the font of the column headings.
  11. HeadingFontWeight = It defines the font-weight of the column headings.
  12. HeadingSize = It defines the font size of the column headings.
  13. Height = It provides the distance between the Data table control’s top and bottom edges.
  14. HoverColor = It defines the text color for the row that the mouse pointer is pointing at.
  15. HoverFill = It provides the background color of the row that the mouse pointer is pointing at.
  16. IsHyperlink = It specifies the property of a column inside a data table that defines whether the selected column should be in hyperlink format or not.
  17. NoDataText = It defines the message that the user receives when there are no records to show in the Data table control.
  18. Order = It specifies the property of a column inside a data table that determines order of the column respective to other columns. The order starts from left to right with first column order value of 1.
  19. SelectedColor = It provies the color of the text in the selected row.
  20. SelectedFill = It provides the background color of the selected row.
  21. Size = It specifies the default font size for all data rows.
  22. Text = It defines the property of a column inside a data table that defines text value of the data to be displayed inside the selected column.
  23. Visible = It defines a value that determines whether the Data table control appears or is hidden.

Availability and Nonavailabilty in PowerApps Data Table

The below table represents what are the features that are available and not available in the PowerApps Data table control.

Available Not Available
1. Data in a Data table control is read-only. 1. Customize the styling of individual columns.
2. A single row is always selected in a Data table control. 2. Add a Data table control in a form control.
3. Link a Data table control to a connected or local data source. 3. Change the height of all rows.
4. Adjust column widths in a Data table control while you run the app, though your changes aren’t saved. 4. Show images in a Data table control.
5. A set of default fields appear in a Data table control when you link it to a connector that has implemented this capability, such as the Microsoft Dataverse. You can then show or hide these fields and others as necessary. 5. Show fields from related tables.
6. Customize column width and heading text. 6. Use built-in functionality to filter and sort data by column heading.
7. Show hyperlinks in a Data table control. 7. Add a Data table control in a Gallery control.
8. Copy and paste a Data table control. 8. Edit data in the Data table control.
9. Select multiple rows.

Issues in Power Apps Data Table

The most important and known issue of the Power Apps Data control is, if you use the FirstN function in the Items property, then no data appears.

PowerApps data table limit

  • While you are using any PowerApps control, then there should be a certain limit up to how much data can be contained by it.
  • Similarly, the PowerApps Data table control is also having some item limitations. At a time a user can add up to 500 records to the data table.
  • If your data source has more than 500 items, then it may appear with the delegation warning issues in PowerApps.
  • In this case, you can change the limit of nondelegatable functions used on data sources from 500 to a maximum of 2000 in PowerApps.
  • To do this, go to Settings (from the left navigation) -> General -> Make Data row Limit to 2000). Here, I believe that these limits are in place to prevent overloading of devices with limited local storage.

Read How to use List Screen in PowerApps

Add a Data Table in PowerApps

Now comes how we can add a Data table in the PowerApps screen. It’s very pretty and simple though.

  • On the screen, Go to the Insert tab -> Click on the Data table. When you will click on it, a blank data table will appear as shown below.
  • You need to connect any data source to the Data table control like SharePoint data source, Excel spreadsheet, Onedrive for business etc.
PowerApps Data Table
  • When you will connect any data source to the data table, then the exisiting data source records will display as shown in the below screenshot.
Power Apps Data Table
  • If you want to design the data table control, then you can do it by using its various properties like Color, Font size, Border, Heading size, Heading font etc.

Check out, PowerApps Navigate to another screen

PowerApps data table filter

Do you want to filter the Data table in PowerApps? If so, then check out these below different scenarios that you can try.

Example – 1: (Filter Data table based on SharePoint field)

  • There is a SharePoint list named Products. This list has some various columns like Title, Vendor, Customer Name, Quantity etc.
  • On the PowerApps, there is a Data table control that is connected with the SharePoint list data source.
  • Now I would like to filter the data table based upon the SharePoint Title field. So, follow the below formula that you can achieve this.
PowerApps data table filter
  • Also, I have a Text input conrol where a user will enter or search any Title value. When the user search any name on that text box, then the data table will filter and it will show all the related item details.
  • Select the Data table and apply the below formula on its Items property as:
Items = Filter(
    Products,
    Title = txtSearchBox.Text
)

Where,

  1. Products = SharePoint List name
  2. Title = Specify the field name that the suer will search in the text box. Not only the title field, but also you can specify any other field like Quantity, Customer Name, Price etc.
  3. txtSearchBox = Text input control name
PowerApps data table example
  • Now save and publish the app. Search any title value (like Mobile) in the text box, then you will see all the filtered related items in the data table control as shown below.
 filter PowerApps data table

Example – 2: (Filter Data table based on SharePoint Choice field)

  • In this scenario, We will see how to filter the PowerApps Data table based on a SharePoint Choice column. Here also I will take the same SharePoint List (Products) from the above example.
  • In that list, there is a Choice column named Vendor. This column has some Vendor values like APPLE, DELL, HP etc. as like below.
Power Apps data table filter SharePoint choice field
  • On the PowerApps screen, there is a Dropdown control having with the below Items property:
Items = Choices(Products.Vendor)
PowerApps data table filter SharePoint choice field
  • Next, apply the below code on Data Table’s Items property as:
Items = Filter(
    Products,
    Dropdown1.SelectedText.Value in Vendor.Value
)

Where,

Dropdown1 = Dropdown control name

filter Power Apps data table
  • Save and Preview the app. Select any vendor choice value from the dropdown control, then you can see the filtered choice result in the data table as shown above.

Example – 3: (Filter Data table based on ComboBox control)

  • In this example, We will see how we can filter the PowerApps Data Table based upon a Combo box control. Here also, I am taking the same SharePoint List named Products.
  • When you will search for any item(s) in the combo box, then the data table will filter and it will show you those Combobox-related filtered values.
  • On the screen, set the below code on a Combo box Items property as:
Items = Products.Title

Where,

Title = Specify the SharePoint column name that the user will select from the combo box. You can provide any column to the combo box control.

powerapps data table filter sharepoint column
  • Next, Insert a Data table and apply the below formula on its Items property as:
Items = Filter(
    Products,
    Title in ComboBox1.SelectedItems
)

Where,

ComboBox1 = Combo box contro name

power apps data table filter sharepoint column
  • Save and Preview the app. Select a single or multi items in the combo box, then you can see the filtered result will appear in the data table control.

Read Display SharePoint Online List Columns in multiple screens in Microsoft PowerApps

PowerApps data table select row

While working with the PowerApps Data table, Do you ever think that Is it possible to select a single row or multiple rows from the data table?

  • Below represents the exact scenario that I want to do so. I would like to select either a single row, multiple rows, or all rows in the data table.
PowerApps data table select row
  • So I searched several sites and found one simple and pretty approach. What I can do is, Its better to use a PowerApps Gallery control instead of a Data table.
  • On the screen, Insert a Vertical gallery control and connect it to the Data source. Here, I have used a SharePoint List data source named TSInfo Attachments.
  • In the below screenshot, you can see the difference between the data table and a gallery that how easily a user can select the row(s) by using the checkbox control. Also, at a time, the user can select all the rows.
Power Apps data table select row
  • To achieve this, select the edit icon from the gallery and insert a CheckBox control to it as shown in the above screenshot.
  • Next, set the below code on gallery’s TemplateFill property as:
TemplateFill = If(
    Checkbox5.Value = true,
    Yellow,
    White
)

Where,

Checkbox5 = Check box control name

PowerApps data table select rows
  • Save and Publish the app. When you will check the row(s) from the gallery, then you can see the selected items will appear with highlighted i.e. yellow color.

PowerApps data table vs gallery

  • There are many different ways where you can display your list of records in Power Apps.
    Apart from that, there are two controls available in PowerApps that can be used for viewing the list of items. Such as Gallery control and Data Table control.
  • You can check out the below article to display the records in various ways in PowerApps.
  • PowerApps Gallery control is a type of control that helps to display a set of records and also it can contain other controls.
  • PowerApps Data table is a type of control that helps to display a set of records in a tabular format. But the thing is, Which control you should prefer for your app?
  • Coming to the answer of the above question is, it depends or varies for a change. Both control is having its advantages and disadvanges that you can follow from the below section.

Differences between PowerApps data table control and gallery control

Advantages and Disadvantages of a Data table Control:

Below represents some of the Pros and Cons of the PowerApps Data Table control.

Advantages:

  1. Each PowerApps Data Table has headers to designate what each control within a row is for. For this, you do not need to add any other controls like Labels, Buttons, etc.
  2. When there is no data in the data table, then the NoData Text property defines what data to display.
  3. There is a property called AutoWidth that helps to allow for column widths to adjust based on the data.
  4. Also, if the data can not fit within the width of the screen, then it provides a horizontal scroll bar.

Disadvantages:

  1. In the data table control, a user can not add an additional control.
  2. To specify the default selected record, there is no such Default property available.
  3. Here, there is no horizontal data table.
  4. A data table can not be used to create a new record or edit a record.

Advantages and Disadvantages of a Gallery Control:

Below represents some of the Pros and Cons of the PowerApps gallery control.

Advantages:

  1. Inside a gallery control, you can add other controls like Label, Dropdown, Checkbox, etc.
  2. You can use gallery control to create a new record, edits and remove records.
  3. In gallery control, there are 2 options available i.e. horizontal (with a horizontal scroll bar) and vertical (with a vertical scroll bar) galleries
  4. In the vertical gallery, you can get more than 1 column, and in a horizontal gallery, you can get more than 1 row. By using its WrapCount property, you can achieve this.
  5. There is also a Flexible height gallery control that can allow for row heights to adjust based on the row data.
  6. In the gallery, a user can auto-scroll as per his/her choice.
  7. By using the Gallery Default property, the default record can be specified.
  8. Also, you can add a PowerApps Loading Spinner to the gallery control.

Disadvantages:

  1. As similar to the Data table headers, there are no headers present in the gallery control. To make a gallery header, you need to insert a Label control or a Button control outside the gallery.
  2. When the gallery control is empty or if there are no records in the gallery, then there will be no default text will be displayed.
  3. There is no horizontal scroll bar for a vertical gallery control.

PowerApps data table hyperlink

Do you want to specify a hyperlink to a text or make a clickable text in PowerApps Data Table? If so, then refer to the below simple scenario that you can try for it.

  • I have a SharePoint List named Blog Sites. This list has two columns called Title and Site URL. Both of the fields are having with Single line of text data type.
  • Now I would like to make the Site URL field values to be clickable in the PowerApps data table control.
PowerApps data table hyperlink
  • The below screenshot represents the PowerApps Data table after it connects the SharePoint List Data source (Blog Sites).
  • When a user will tap on any link from the Site URL, then that specific web link or website will open in a new browser.
Power Apps data table hyperlink
  • To workaround with this, At first, you need to enable the Is Hyperlink property of the Site URL column. Select the field from the data table -> go to Properties -> Toggle on to the Is Hyperlink property as shown below.
  • When you will make this property to enable, then the URL field values will appear with an underlined blue color.
data table hyperlink in Power Apps
  • Next, Select the OnSelect property of the Site URL field and apply the below code:
OnSelect = Launch(BlogData.Selected.'Site URL')

Where,

  1. Launch = PowerApps Lunch function helps to launch a URL from the Site URL column
  2. BlogData = Data table name
  3. ‘Site URL’ = Data table column name that you want its data to make as clickable
data table hyperlink in PowerApps
  • Save and Preview the app. When you will click on any link from the Site URL field, then the specific link will open in a new browser.

PowerApps data table wrap text

  • As you know in most of the PowerApps input control, there is a property called Word wrap. Once you will enable this property, then it will help you to display the data with multi line of text.
  • Similarly, while you are working with the PowerApps Data table, the same thing may happen with you that you can not see the multiline at a time in the data table control. Refer to these below screenshots for your reference purpose:
PowerApps data table wrap text
PowerApps data table wrap text
Power Apps data table wrap text
Power Apps data table wrap text
  • But unfortunately, currently the Word wrap property is not supported in the Data table control. Instead of the Word wrap, you can use the Can grow property.
  • By using this property, you need to require the width of your screen to be wide enough. Then only you will see the result.
  • Alternatively to get the wraptext property, the better option would be to create a flexible height gallery and make it look like a data table.

PowerApps data table conditional formatting

In this topic, We will see how to work with PowerApps data table conditional formatting. Do you ever want to provide some color to the selected row within a PowerApps DataTable control? If so, then you can follow the below things.

  • There is a PowerApps Data table control where all the fields and values are retrieved from a SharePoint List Data Source (Products).
  • The list has one choice field called Status having some choice values like Submitted, Approved, Rejected, Pending.
  • Now I would like to provide Red color to the selected rejected row in the data table. This means, When a user will select the Rejected status, then that specific row will appear with the Red color as shown in the below screenshot.
PowerApps data table conditional formatting
  • To achieve this, We can use a property named SelectedColor which means the color of the text in the selected row in the Data table control.
  • Select the data table and apply the below code on its SelectedColor property as:
SelectedColor = If(
    DataTable7.Selected.Status.Value = "Rejected",
    Red,
    Black
)

Where,

  1. DataTable7 = Data table control name
  2. Status = SharePoint choice field name
  3. “Rejected” = Specify the choice value that you want to view with red color

The above code specifies if the data table selected value is Rejected, then it will appear with red color otherwise it will be black color.

NOTE:

If the SharePoint Status column is a Single line of Text column, then you can use this code on data table’s SelectedColor property as: If(DataTable7.Selected.Status = “Rejected”, Red, Black )
Power Apps data table conditional formatting
  • Now save and preview the app. Select the Rejected row in the data table, you can see the selected row will appear with red color.

PowerApps data table filter and sort

By using these below scenarios, We will discuss how to work with the Filter function and the Sort function in the PowerApps Data table.

Example – 1:

  • In this example, there is a Date field (Sales Date) in a data table control (all the fields are retrieved from the SharePoint list). Now I want to sort these dates in descending order.
  • To do so, Select the Data table control and apply the below code on its Items property as:
Items = SortByColumns(
    Products,
    "SalesDate",
    Descending
)
  • As for this example, I wanted to display the date field as descending order, thats why I have mentioned Descending in the formula. If you want to show the date field as in ascending order, then you just need to mention as Ascending in the formula.
PowerApps data table filter and sort
  • Once you will save and preview the app, you will see the result as like the above screenshot.

Example – 2:

  • In this scenario, I want to filter the data table based upon a SharePoint Choice field (Status) also sort (in descending order) the date field at the same time in the data table.
  • To achieve this, apply the below code on Data table’s Items property as:
Items = SortByColumns(
    Filter(
        Products,
        Status.Value = "Approved"
    ),
    "SalesDate",
    Descending
)

Where,

  1. Products = SharePoint List name
  2. Status = SharePoint Choice field
  3. “SalesDate” = SharePoint Date field
  • The above code specifies it will filter the data table and display only the Approved items including the date field with descending order.
Power Apps data table filter and sort
  • Once you will save and preview the app, you will see the result as like the above screenshot.

PowerApps data table add custom column

Now comes to how we can add a custom column in the PowerApps Data table control?

  • To add any column in the Data table, first of all, it’s important to connect any data source (suppose SharePoint) to the data table control. Once you will connect the data source, then some of the fields will appear in the data table and some of the fields will be in hiding mode.
  • Suppose you want to add some more hidden SharePoint columns in the Data table, then follow the below instructions:
    • Select the Data table -> Go to its Properties pane -> click on Edit Fields from the Fields section -> + Add Field -> select the fields those you want to display in the data table (as like Created, Created By, ID, etc) -> tap on the Add button as shown in the below screenshot.
PowerApps data table add custom column
  • When you will save and preview the app, you can see the new columns will appear in the data table. Refer to the below screenshot.
Power Apps data table add custom column

PowerApps data table add button

  • Suppose you are having a Data table where all the data are retrieved from a SharePoint List. Now you would like to add some icons to each row (like view or edit) and navigate to a different screen to view or edit the selected row.
  • To workaround with this, go through the below forum link that you can try for:

PowerApps data table add button

PowerApps data table alternate row color

  • When you are working with the PowerApps Data table, you may need to design the table as per the requirement. The requirement as like to provide some color to the table rows.
  • This means when a value changes between one row and another, you need to change the table row color.
  • So coming to this point, there is no such limitation where we can design the data table with alternate row colors.
  • In this case, instead of using a Data table, you can use a Gallery control where you can insert some labels inside the gallery to look like a data table. After that, you can provide the color to the gallery rows.
  • You can use the TemplateFill property of the gallery control to provide the row color.
  • For example, suppose you want all values in a field called Status where the value was Approved to be coloured Yellow, then you can use the below code to the Gallery’s TemplateFill property as:
TemplateFill = If(
   ThisItem.Status="Approved",
   Yellow,
   White
)

PowerApps filter data table based on dropdown

Would you like to filter the data table by a PowerApps dropdown control? If so, then refer to the below simple example.

  • There is a Dropdown control and a Data table control in the app. When I will select an item from the dropdown, then the gallery will filter and it will display only the dropdown selected item details as shown in the below screenshot.
PowerApps filter data table based on dropdown
  • To work around with this, Select the Dropdown control and set its Items property as:
Items = Distinct(Products, Title)

Where,

  1. Products = SharePoint List Name
  2. Title = SharePoint list column that you want to appear in the dropdown
Power Apps filter data table based on dropdown
  • Next, select the Data table control and set the following formula to its Items property:
Items = Filter(
    Products,
    Title = Dropdown2.Selected.Result
)

Dropdown2 = Dropdown control name that is having all the title field values

PowerApps filter data table based on dropdown control
  • At last, save and preview the app. When you will select any item from the dropdown control, you will see the selected dropdown filtered result in the data table.

PowerApps data table sort by column

Here in this topic, We will see how to work with the PowerApps data table sort by column.

  • The SortByColumns function is used to sort a table based on one or more columns. For the ColumnName argument part of this function, you should specify a Column name.
  • In this example, We will sort the list items based on the Author column (also, it is known as Created By column) using the SortByColumns function. And also the result will display in a PowerApps data table.
  • Below table represents how the data table looks like after sorting the items based upon the Author column.
PowerApps data table sort by column
  • To achieve this, apply the below code on the Data table’s Items property as:
Items = Sort(
    Products,
    Author.DisplayName,
    If(
        order,
        Ascending,
        Descending
    )
)

Where,

  1. Products = SharePoint List Name
  2. Author = SharePoint Created By field name. Here, you need to specify the author with the DisplayName
  3. order = Context variable name that I will create in the button control
  4. Ascending, Descending = Mention the order that you want to sort the Author field
Power Apps data table sort by column
  • Next, insert a Button control (Rename it to SORT) and set its OnSelect property to the below formula:
OnSelect = UpdateContext(
    {
        SortBy: "",
        order: !order
    }
)

Where,

order = Context Variable Name

PowerApps data table sortbycolumn
  • Save and Preview the app. Once you will click on the SORT button, then you can see the Author column will display with an Ascending order otherwise it will be in Descending order.

PowerApps data table group by

To learn about the PowerApps group by function, you can refer to the below article:

Power Apps GroupBy Function example

PowerApps datatable checkbox

Do you want to add a checkbox control in the PowerApps Data table control?

  • Previously the check box control was not supporting in the data table as we know the Data tables are for read only. So a user could not be able to set it up in-row editing like that.
  • As the data Tables are non-editable data, so alternatively, we were using a Gallery instead if you want to allow user’s to edit.
  • But now, as it supported in the data table, so follow the below thing that you can try for.
  • In the below screen, you can see there is a Yes/No field (named Active Or Inactive) in the SharePoint list (Blog Sites). Now I would like to insert this field in the data table control.
PowerApps datatable checkbox
  • In the PowerApps, Select the Data table -> Click on Edit fields -> + Add field -> Search or Choose the check box field field (Active Or Inactive) -> Tap on the Add button as shown below.
Power Apps datatable checkbox
  • Now you can see the check box field will appear in the Data table control as like the below screenshot.
PowerApps datatable checkbox control

This is how we can work with the PowerApps data table checkbox.

PowerApps data table distinct

Do you want to show the distinct value in a PowerApps Data Table control? Refer to the below simple scenario that you can try.

  • In the below scenario, there is a Dropdown control and a Data Table control. Whenever a user will select any value from the dropdown, then the data table will filter and display the distinct value based upon the dropdown selection.
  • For example, Suppose I have selected APPLE from the dropdown, then the data table displayed with the unique value details of that specific selected dropdown item as shown below.
PowerApps data table distinct
  • To workaround with this, select the Dropdown and set its Items property as:
Items = Distinct(
    Products,
    Vendor.Value
)

Where,

  1. Distinct = PowerApps Distinct function helps to get the unique values from any data sources
  2. Products = SharePoint List Name
  3. Vendor = SharePoint Choice field
Power Apps data table distinct
  • Next, Select the Data table and apply the below code on its Items property as:
Items = First(
    Filter(
        Products,
        Vendor.Value = Dropdown3.SelectedText.Value
    )
)

Where,

Dropdown3 = Dropdown control name that contains all the vendor values from the SharePoint List

PowerApps distinct data table
  • Save and Preview the app. When you will select any value from the dropdown menu, then the data table will filter and show you the filtered unique result.

PowerApps data table delete row

Do you want to delete or remove the selected record from the PowerApps Data Table control? If so, then you can refer to the below different scenarios.

Scenario – 1:

  • Normally, there is a Data table control where all the records are retrieved from the SharePoint List (Products).
  • Now I would like to delete the selected record from the PowerApps Data table when a user will click on a button control.
  • For example, I want to delete the selected third record when I will tap on the button (named Delete Selected Row) as like the below screenshot.
  • To achieve this, apply the below code on Button’s OnSelect property as:
OnSelect = Remove(
    Products,
    DataTable14.Selected
)

Where,

DataTable14 = Specify your data table control name where you want to delete the particular selected row or record

PowerApps data table delete row
  • Now Save and Preview the app. Select the record (if not selected) that you want to delete and then tap on the button. Once you will tap on the button, then you can see the specific record has been deleted from the data table as shown below. Also, at the same time, by default the first record will select automatically.
Power Apps data table delete row

Scenario – 2:

  • In this second scenario, I would like to remove the default selected row from the data table while the screen loads the first time.
  • For example, in some cases, When a user opens the screen by default, always the first row is selected in the data table that I do not want. Now I want to remove the default selected row. Follow the below steps that you can try. Refer to the below screen for your reference purpose.
delete row in PowerApps data table

Step – 1:

At first, select the screen and set its OnVisible property to the below code:

OnVisible = Set(
    varLoadFirstTime,
    true
)

Where,

varLoadFirstTime = Specify the variable name and set its value to true

PowerApps data table delete rows

Step – 2:

Select the Data table and apply the below formula on its SelectedFill property as:

SelectedFill = If(
    varLoadFirstTime,
    Transparent,
    RGBA(
        56,
        96,
        178,
        .2
    )
)
delete row in Power Apps data table

Step – 3:

At last, select all the columns (Ctrl+Click) of the data table control and set the below code to their OnSelect property as:

OnSelect = Set(
    varLoadFirstTime,
    false
)
delete rows in PowerApps data table

Now save, publish, and close the app. Once you will reopen the app again, you will see the default selected row has been removed from the data table. When you will select any row, then only the row will select in the data table.

PowerApps data table date format

To work around with the Date format in the PowerApps Data table, follow the below forum link that you can test if your date format is not appearing correctly in the data table.

Date format gets messed up in a Data table

Also, there is a post on the site, that is purely based on the PowerApps Date Time Picker, check out through the below link:

How to use date time picker in PowerApps

PowerApps data table default select row

In this topic, We will discuss how to work with the PowerApps data table default select row. In the below scenario, I want to set the default selected values from the data table as blank.

  • In this scenario what happens is, there is a Text input control and as well as a Data table control. When a user will select any row in the data table, then that specific item is populated in the text input field.
  • For example, here in the data table, as I have selected the 4th row (i.e. PowerApps Sales Sheet), so the title field value is displaying in the text input control as shown below.
PowerApps data table default select row
  • When I am opening the app everytime, I used to see the data table default selected value is appearing in the text input control and that should not be. In this case, I would like to set the input field as blank everytime I will open the app.
  • To achieve this, set the below code on screen’s OnVisible property as:
OnVisible = UpdateContext({SetBlank: true})

Where,

SetBlank = Specify the variable name

Power Apps data table default select row
  • Next, select (Ctrl+click) the OnSelect property of the each column of the Data table and apply the below formula:
OnSelect = UpdateContext({SetBlank: false})
default select row in PowerApps data table
  • At last, select the text input control and apply the below code on its Default property as:
Default = If(
    SetBlank,
    "",
    DataTable19.Selected.Title
)

Where,

  1. Data table19 = Data table control name
  2. Title = This is the SharePoint Column name. Whatever you will specify the column name, that value will display in the Text input control
default select row in Power Apps data table
  • Save, Publish, and Close the app. When you will reopen the app again, you can see the text input control has been empty even if the data table has the default selected value as shown below.
default selected row in PowerApps data table

This is how we can work with PowerApps data table default select row.

PowerApps data table empty

In this topic, by taking a simple example, We will work with the PowerApps data table empty.

  • In this scenario, I would like to display all data in the data table when dropdown is empty. That means, if no item is selected in the dropdown or if the dropdown is blank, then the data table will display all the record (retrieved from the SharePoint List). Refer to the below screenshot.
PowerApps data table empty
  • To achieve this, apply the below formula on Data table’s Items property as:
Items = If(
    IsBlank(Dropdown4),
    Products,
    Filter(
        Products,
        'Customer Name' = Dropdown4.SelectedText.Value
    )
)

Where,

  1. Dropdown4 = Dropdown control name
  2. Products = SharePoint List Name
  3. ‘Customer Name’ = Specify a SharePoint field name that you will use in the dropdown control
Power Apps data table empty
  • When you will save and preview the app, you can view the result in the data table control.

PowerApps data table functions

Do you have any idea what are Data table functions in PowerApps and how a user can use them easily? Check out the below PowerApps tutorial that is purely related to the PowerApps Table() Function.

How to use PowerApps Table() Function

PowerApps data table grid lines

Similarly, Do you know that what is a Grid view and how to create gridlines using a PowerApps Data table? If so, then you can follow the below simple article that I have already written and posted on my site:

PowerApps data table grid lines

PowerApps data table hide column

Do you ever want to hide the column(s) in a PowerApps Data table control? If so, then you can achieve your needs by using the below simple and pretty example.

  • In this example, I would like to hide a column(s) when the PowerApps screen is loaded and the column(s) should be only visible when a button is pressed by the user.
  • Below represents a data table where there are total three columns named (Title, Attachment Types, Attachment Costs). Now I want to hide the second column (i.e. Attachment Types) at the time of screen load. And also, it will visible when I will tap on the button. Refer to the below processes to do so.
PowerApps data table hide column
  • At first, apply the below formula on Screen’s OnVisible property:
OnVisible = UpdateContext({varDispColumn: false})

Where,

varDispColumn = Variable name. You can specify any variable name

Power Apps data table hide column
  • Next, select the column (Attachment Types) that you want to hide in the data table and set its Visible property to the below code:
Visible = varDispColumn
PowerApps data table hide columns
  • At last, insert a button control and set its OnSelect property to the below formula:
OnSelect = UpdateContext({varDispColumn: true})
Power Apps data table hide columns
  • Save, Publish, and Close the app. Reopen the app again and Preview (F5) it. You can see the specific column has been hidden in the data table control. When you will tap on the Show button, then the field will visible in the table.
  • To get more examples about PowerApps Show Hide columns, you can follow the below PowerApps Tutorial:

Show hide fields based on dropdown selection PowerApps (2 Examples)

PowerApps data table total row

Suppose, there is a data table control and you need to count the total number of rows or records within that table. To do this, there is a post on my site that you can refer through the below link:

PowerApps data table total row

Also, you can refer to the below PowerApps tutorials:

PowerApps data table sharepoint list

  • As we know there are various ways where we can display the SharePoint List items in PowerApps. Among all, the PowerApps Data table is one of them that a user can use to view all the SharePoint Records.
  • The second thing that comes to your mind is, how you can use it in the app. To know all the details, you can refer to the below complete tutorial:

PowerApps data table SharePoint list

PowerApps data table on select

To workaround with the PowerApps data table on select, you can refer to the below forum link and try it out:

PowerApps data table on select

PowerApps data table sum column

In this last topic, We will see how we can calculate the sum of a column in PowerApps Data table control.

  • Let’s say, there is a Data table control and there are some columns like Title, Vendor, Quantity, Price, etc. Now I would like to calculate the total number of quantities (from Quantity column) from that data table and the result will display in a label control.
  • For this, I tried the below formula on the Label’s Text property as:
Text = "Total Sum of Quantity: " & Sum(DataTable18, 'Quantity')

Where,

DataTable18 = Name of the Data table control

PowerApps data table sum column
  • When I saved and previewed the app, then an error is appearing like “The function ‘Sum’ has some invalid arguments“. So there is no direct way to achieve this in the PowerApps Data table.
  • To workaround with this, there are two different ways where you can try for. These are:
  1. Calculate the total sum of the column using SharePoint List
  2. Calculate the total sum of the column using a Gallery control

Calculate the total sum of the column using SharePoint List

  • Select the Label control and set the below code on its Text property as:
Text = "Total Sum of Quantity: " & Sum(Products, 'Quantity')

Where,

Products = SharePoint List Name

Power Apps data table sum column
  • Once you will save and preview the app, you can see the total sum of quantities (i.e. 78) in the label control as shown above.

Calculate the total sum of the column using a Gallery control

  • To calculate the sum of a data table column, the best approach is to use a Gallery control instead of using a Data table.
  • Insert a Gallery control and connect the SharePoint List Data source i.e. Products.
  • Next, set the label control and apply the below formula on its Text property as:
Text = "Total Sum of Quantity: " & Sum(
    Gallery2.AllItems,
    'Quantity'
)

Where,

Gallery2 = Gallery control name

PowerApps data table column sum
  • When you will save and preview the app, you can see the total sum of quantities (i.e. 78) in the label control as shown above.
  • To learn more about the PowerApps data table sum column, you can checkout the below complete tutorial:

PowerApps data table sum column

PowerApps Data Table Export

Do you ever want to export data from a Power Apps Data Table control into an Excel file? Do not hesitate. It’s pretty much simple as much as you think of it.

In this section, By using a simple scenario, I will share with you that how we can export PowerApps Data Table records into an Excel sheet.

How to Export data from DataTable to Excel in PowerApps

So whenever you are trying to export the data from a data table control to an Excel file, as I searched so many sites and found that there is no such direct way to achieve the need in PowerApps currently.

Why this is not possible because there are no such functionalities or functions that can support within PowerApps to export data from a Data Table control.

To achieve this requirement in PowerApps, there is an alternative solution that we can try. What we can do is, instead of taking a Data table, insert a Gallery control that can work as a Data Table control. So follow the below instructions that you can work around with:

Scenario:

  • There is a SharePoint List named Book Purchase Info. This list has three columns such as:
  1. Book Name = By default it is a Title field with single line of text data type
  2. Sales Date = This is a Date Time Data type field
  3. Book Price = It is a Currency Data type field

The list looks like the below screenshot.

PowerApps Data Table Export
  • Now I would like to export these SharePoint List records to the Excel File through the PowerApps Data Table control.
  • So next we will create a Excel file and create these three columns (Book Name, Sales Date, and Book Price) on it. Select the fields, format it as a Excel Table, and provide a name to the excel table (like BookDetails). Below represents the Excel file screenshot that you can refer.
Power Apps Data Table Export
  • Once the excel file is ready, you need to upload this file in your cloud service, e.g. OneDrive. Go to OneDrive -> Upload -> Files -> select the Excel file from your local system -> Upload.
PowerApps DataTable Export
  • Now its time to configure your data in your Data table into a Gallery in PowerApps as below. On the screen, Insert a Blank Vertical Gallery control and above that gallery, add four Label controls.
  • You can use one Label for the Gallery Title purpose (like Book Purchase Details) and other three labels you can use for Gallery fields/columns purpose like Book Name, Book Price, and Sales Date as shown below.
how to export powerapps data table
  • Edit the gallery using the edit icon or select the first section of the gallery and add a Label control on to it. Similarly, add two more labels for Book Price and Sales Date as like the below screenshot.
how to export power apps data table
  • Next, Connect the Data sources (SharePoint and as well as OneDrive for Business where the excel represents). Connect the same SharePoint List (Book Purchase Info) to the app.
  • Select the gallery control and add the SharePoint list to its Items property as:
Items = 'Book Purchase Info'
  • When you will connect the SharePoint list to the gallery, you will see all the SharePoint field values or records in the gallery control as like below.
export power apps data table
  • At last, to export the SharePoint Data to Excel sheet, Insert a Power Apps Button control and rename it to Export. Select the button and apply the below formula on its OnSelect property as:
OnSelect = ForAll(
    Gallery1.AllItems,
    Patch(
        BookDetails,
        Defaults(BookDetails),
        {
            BookName: Label1.Text,
            BookPrice: Label2.Text,
            SalesDate: DateValue(Label3.Text)
        }
    )
)

Where,

  1. ForAll = PowerApps ForAll function helps to evaluate the formula and perform actions for all the records in a table. To learn more about this function, check out this detailed tutorial: PowerApps ForAll Function
  2. Gallery1 = This is the Gallery control name
  3. Patch = PowerApps Patch Function is used to modify single or multiple records of a data source. For more details, you can refer this complete tutorial: PowerApps Patch Function
  4. BookDetails = Provide the name of the Excel Table
  5. BookName, BookPrice, SalesDate = These are the columns that are present in the Excel sheet
  6. Label1, Label2, Label3 = These are the controls that present within the gallery. As Label3 specifies the date value, so I used the DateValue function.
export powerapps data table control
export powerapps data table control
  • That’s what to do in PowerApps. Now save and preview (F5) the app. Just click on the Export button. When you will on the export button, then it will start to export the data from the gallery to excel file.
  • Now go to the OneDrive cloud storage where you uploaded the excel file previously. Refresh the site and then open the specific excel file. As soon as it refreshed, you can view all the exported gallery records in the excel sheet as it is. Only one extra column has been added to the file is PowerAppsId as like the below screenshot.
export powerapps data table
export powerapps data table

So this tutorial explains how to export PowerApps Data Table records into an Excel File using PowerApps Gallery control.

Also, you may like these below PowerApps Tutorials:

In this Power Apps Tutorial, We will discuss what is PowerApps Data Table control, What are the Data table properties, and how we can use it in Power Apps. Also, We looked out to the below topics:

  • What is a PowerApps Data Table Control
  • Various PowerApps Data Table Properties
  • What are the availability and nonavailabilty in PowerApps Data Table
  • Issues in PowerApps Data Table
  • What is the PowerApps data table limit
  • How to add a Data Table in PowerApps
  • How to use filter in PowerApps data table
  • PowerApps data table select row
  • Difference between PowerApps data table vs gallery
  • PowerApps data table hyperlink
  • PowerApps data table wrap text
  • PowerApps data table conditional formatting
  • PowerApps data table filter and sort
  • PowerApps data table add custom column
  • PowerApps data table add button
  • PowerApps data table alternate row color
  • PowerApps filter data table based on dropdown
  • PowerApps data table sort by column
  • PowerApps data table group by
  • PowerApps datatable checkbox
  • PowerApps data table distinct
  • PowerApps data table delete row
  • PowerApps data table date format
  • PowerApps data table default select row
  • PowerApps data table empty
  • PowerApps data table functions
  • PowerApps data table grid lines
  • PowerApps data table hide column
  • PowerApps data table total row
  • PowerApps data table sharepoint list
  • PowerApps data table on select
  • PowerApps data table sum column
  • PowerApps data table export
>