cancel
Showing results for 
Search instead for 
Did you mean: 
DavidZoon

Use Copy() function to copy and paste tabular formatted data from Power Apps to Excel

When we copy a selection of cells from Excel, and paste the contents into Notepad, we can notice that:

  1. Columns are separated by a tab
  2. Lines are separated by a carriage return

We can therefore use the Concat() and Char() functions to reproduce this format. In the following example, we are going to use a "Sample List", which contains the columns:

  • Name (type text)
  • Number (decimal type)
  • Choice (choice type)
  • DateTime (DateType)
  • YesNo (Boolean type)
  • ImageUrl (Type Text)

we are going to add a button or an icon with the following code in its OnSelect property:

 

 

Copy(
    Concat(
        'Sample List',
        Name & Char(9) & Number & Char(9) & Choice.Value & Char(9) & Text(DateTime,DateTimeFormat.ShortDateTime,"fr-FR") & Char(9) & YesNo & Char(9) & ImageUrl,
        Char(13)
    )
);Notify("All gallery data copied to clipboard",NotificationType.Success)

 

 

DavidZoon_0-1682529120204.png

 

We concatenate the values of each line, separated by a Char(9) which is the tab character.

We define the separator of our Concat() function with a Char(13) which is the code for the carriage return character.

We then add a Notify() to let the user know the data has been successfully copied to the clipboard.

 

At this point, this is what the contents of the clipboard look like:

 

 

Lorem *	712.54	Choix 3	08/11/2022 13:15	true	https://i.insider.com/602ee9ced3ad27001837f2ac?width=1000&format=jpeg&auto=webp
Ipsum	196.22	Choix 2	05/09/2022 05:30	false	https://wallpapercave.com/wp/wp9414344.jpg
Dolor	504.39	Choix 3	02/09/2022 09:00	true	https://cdn.musicfeeds.com.au/assets/uploads/2021/02/Rick-roll-2021.png
Sit	175.74	Choix 2	06/11/2022 08:00	false	https://i.ytimg.com/vi/Gm2IgoXVB5I/maxresdefault.jpg
Amet	634.15	Choix 3	30/09/2022 09:00	true	https://th.bing.com/th/id/OIP.kBv7vHExzeSqcP4QQeKTYAHaEK?pid=ImgDet&rs=1
Consecutor	814.4	Choix 1	08/09/2022 09:00	false	https://i.ytimg.com/vi/5GTTYyQ2PKg/hqdefault.jpg
Drecuasers	361.67	Choix 1		false	https://th.bing.com/th/id/OIP.a_LfXVUcCaxB2Du2aPApwQHaD5?pid=ImgDet&rs=1
Rolmunaris	672.19	Choix 3		true	https://th.bing.com/th/id/R.53397c074774d50bf6869a91fd389b3c?rik=hIsRGz0BBUlt3w&pid=ImgRaw&r=0
Sin Pecador	421.37	Choix 1		true	https://i.imgflip.com/4ty18o.jpg
cansuilis	43.79	Choix 1	23/11/2022 00:00	true	https://www.punto-informatico.it/app/uploads/2021/02/rick.jpg
Veritas	852.33	Choix 1	15/11/2022 00:00	true	https://i.insider.com/602ee9ced3ad27001837f2ac?width=1000&format=jpeg&auto=webp
Nouveau	9.5	Choix 1	15/12/2022 15:30	true	https://i.ytimg.com/vi/Gm2IgoXVB5I/maxresdefault.jpg

 

 

But once pasted into Excel, each value is housed in its cell!

 

DavidZoon_1-1682529494510.png

 

Comments