Copy/paste a DataFrame into a PowerPoint table

I’m looking if anyone in the community have already come with a quick/simple way to just “copy paste” a DataFrame, whose columns are all composed of real numbers, into a PowerPoint table. Would save me tons of time!!! Extra kudos if it also copies the column headers!

1 Like

ClipData.jl (link here) is exactly what you want!

Well, maybe it’s not exactly what you want, since it only grabs tab-delimited output. Maybe there is a way to send html output from PrettyTables.jl to the clipboard.

7 Likes

Frikin brilliant! Note: I had to first paste the result into Excel, and then copy from Excel into PowerPoint so that PowerPoint recognizes this as a table, but that wasn’t a big deal!!!

1 Like

AFAIK it is possible to put HTML into clipboard from JavaScript, and it should be possible to call JS from Julia.

Here’s how I do it - slightly more involved but useful to ensure updates to the Julia analysis are reflect in the PowerPoint:

  1. Create an Excel file with a table that has your desired output:

  1. From the Excel, copy over your table and past it into your PowerPoint with “Paste special” (Ctrl+Alt+V). In the paste special dialogue box, select “Paste link” and “Microsoft Excel Worksheet Object”:

image

  1. Run your analysis, get new results, and write them into the Excel file using XLSX.jl - here’s an example where I’m changing the last number in the table:
julia> XLSX.openxlsx(excel_file, mode="rw") do xf
           sheet = xf[1]
           sheet["E9"] = 20.5
       end
20.5
  1. In the PowerPoint, right click your table and select “Update link”:

image

  1. Et voilà:

image

3 Likes