Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[data grid] Implement Clipboard import #199

Closed
oliviertassinari opened this issue Aug 21, 2020 · 37 comments · Fixed by #7389
Closed

[data grid] Implement Clipboard import #199

oliviertassinari opened this issue Aug 21, 2020 · 37 comments · Fixed by #7389
Assignees
Labels
component: data grid This is the name of the generic UI component, not the React module! linked in docs The issue is linked in the docs, so completely skew the upvotes new feature New feature or request plan: Premium Impact at least one Premium user v6.x

Comments

@oliviertassinari
Copy link
Member

oliviertassinari commented Aug 21, 2020

Summary

Copy and paste data between an Excel sheet and a Data Grid.

Benchmark

@oliviertassinari oliviertassinari added component: data grid This is the name of the generic UI component, not the React module! new feature New feature or request labels Aug 21, 2020
@oliviertassinari oliviertassinari changed the title [DataGrid] Implement export to clipboard [DataGrid] Implement Clipboard export/import Aug 21, 2020
@simoami
Copy link

simoami commented Sep 30, 2020

Bidirectional compatibility with Excel clipboard data is desired. That is copy from Excel, paste in the data grid and vice versa.

@oliviertassinari oliviertassinari added the linked in docs The issue is linked in the docs, so completely skew the upvotes label Nov 30, 2020
@AJMoores
Copy link

Would love to see the ability to copy a particular cell or entire column to clipboard.

@oliviertassinari oliviertassinari added components: XGrid and removed component: data grid This is the name of the generic UI component, not the React module! labels Jul 17, 2021
@oliviertassinari oliviertassinari changed the title [DataGrid] Implement Clipboard export/import [XGrid] Implement Clipboard export/import Jul 17, 2021
@oliviertassinari
Copy link
Member Author

oliviertassinari commented Jul 17, 2021

We have recently done an iteration in #1929. What we seem we still have to do on what we have already built (ignoring what's we could build next):

@oliviertassinari oliviertassinari changed the title [XGrid] Implement Clipboard export/import [DataGridPro] Implement Clipboard export/import Aug 30, 2021
@oliviertassinari oliviertassinari added the plan: Pro Impact at least one Pro user label Dec 5, 2021
@Mahdi-Matar96
Copy link

Would love to see the ability to copy a particular cell or entire column to clipboard.

@mattyb
Copy link

mattyb commented Jan 5, 2022

Would love to see copy prioritized over paste.

@sean-peters-au
Copy link

We would love this too! Both copy and paste!

@zzZCodeZzz
Copy link

Would be real nice

@ohechtl
Copy link

ohechtl commented Jan 20, 2022

I'd love to use this feature, both copy and paste as well!

@oliviertassinari oliviertassinari added feature: Export plan: Premium Impact at least one Premium user and removed feature: Export plan: Pro Impact at least one Pro user labels Jan 29, 2022
@oliviertassinari oliviertassinari changed the title [DataGridPro] Implement Clipboard export/import [DataGridPro] Implement Clipboard import Feb 2, 2022
@samborambo305
Copy link

This would be a massive upgrade to data grid

@samborambo305
Copy link

@oliviertassinari do you anticipate that this feature will have full copy and paste functionality across multiple selected cells? This would be similar to: https://ag-grid.com/javascript-data-grid/clipboard/ that you mentioned in the benchmark?

@samborambo305
Copy link

/ Is there any way to pay to have this implemented sooner?

@oliviertassinari oliviertassinari changed the title [DataGridPro] Implement Clipboard import [data grid] Implement Clipboard import Mar 16, 2022
@flaviendelangle flaviendelangle added the component: data grid This is the name of the generic UI component, not the React module! label Oct 17, 2022
@mdarifmustafa
Copy link

upvote for feature.

@markwindsorr
Copy link

Is this going to be released. Anyone can recommend a library that has this feature? Thanks

@nkeat12

This comment was marked as resolved.

@dnvMarcLeBlanc
Copy link

Any update on this feature?

@exisapra
Copy link

updates?

@cherniavskii
Copy link
Member

You can check out the preview of the feature in #7389
Feedback is welcome!

@FlorianCassayre
Copy link

Hi, will this be included in the community version or the closed-source one?

@cherniavskii
Copy link
Member

@FlorianCassayre Clipboard import is a Premium feature and will not be included in the Community plan

@joserodolfofreitas joserodolfofreitas moved this from Q1 2023 Jan - Mar to Q2 2023 Apr - Jun in MUI X public roadmap Apr 24, 2023
@gotexis
Copy link

gotexis commented Apr 25, 2023

I have a raw solution in case anyone is interested. https://gist.github.com/gotexis/34ed4ba97317303acb233e4cbb035725

@dep
Copy link

dep commented May 3, 2023

Quick and dirty "copy table to clipboard" js:

<button id="copyButton">Copy to Clipboard</button>
<script>
  function copyToClipboard(text) {
    const textarea = document.createElement("textarea");
    textarea.value = text;
    document.body.appendChild(textarea);
    textarea.select();
    document.execCommand("copy");
    document.body.removeChild(textarea);
  }

  function getTableData() {
    const rows = document.querySelectorAll(".MuiDataGrid-row");
    let data = "";

    rows.forEach((row) => {
      const cells = row.querySelectorAll(".MuiDataGrid-cellContent");
      cells.forEach((cell, index) => {
        data += cell.textContent;
        if (index < cells.length - 1) data += "\t";
      });
      data += "\n";
    });

    return data;
  }

  document.getElementById("copyButton").addEventListener("click", () => {
    const tableData = getTableData();
    copyToClipboard(tableData);
    alert("Data copied to clipboard");
  });
</script>

CleanShot 2023-05-03 at 15 27 36 2

@oliviertassinari
Copy link
Member Author

oliviertassinari commented Jul 18, 2023

The link to the docs for this feature: https://mui.com/x/react-data-grid/clipboard/#clipboard-paste. It was released in v6.4.0 https://github.com/mui/mui-x/releases/tag/v6.4.0

@dep
Copy link

dep commented Jul 18, 2023

Also it might not be immediately obvious, but click/drag/select works, you just need to start within the table, not outside of it.

CleanShot 2023-07-18 at 16 32 38

@dep
Copy link

dep commented Jul 18, 2023

@oliviertassinari It's not explicitly stated in the docs, but is Clipboard Copy a Premium-only feature?

@oliviertassinari
Copy link
Member Author

oliviertassinari commented Jul 18, 2023

but is Clipboard Copy a Premium-only feature?

@dep It's open source per https://mui.com/pricing/

Screenshot 2023-07-18 at 23 57 42

However, I agree with you, it's confusing, a new issue #9725

@dep
Copy link

dep commented Jul 18, 2023

I do see that it is indeed a Community / Pro feature, thanks!

Unfortunately when I try to use 6.10.0 of DataGridPro per these instructions, I'm not having any luck being able to drag/select rows to copy:

<DataGridPro
  disableRowSelectionOnClick
  unstable_cellSelection
  ignoreValueFormatterDuringExport
  autoHeight
  rows={data.rows.slice(0, nbRows)}
  {...data}
/>

Desired result:

image

Actual result:

CleanShot 2023-07-18 at 18 04 35

@dep
Copy link

dep commented Jul 18, 2023

It almost looks like, from here that selecting cells is a premium-only feature:

On the DataGridPremium, you can also enable the ability to select cells with the unstable_cellSelection prop.

@dep
Copy link

dep commented Jul 18, 2023

It looks like cellSelection must fall into the "Range Selection" bucket. Another row for "Cell Selection" might help clarify:

CleanShot 2023-07-18 at 18 41 14

@oliviertassinari
Copy link
Member Author

oliviertassinari commented Jul 18, 2023

It looks like cellSelection must fall into the "Range Selection" bucket. Another row for "Cell Selection" might help clarify:

@dep Ah yes, it's the same thing, fixed in mui/material-ui#38029.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: data grid This is the name of the generic UI component, not the React module! linked in docs The issue is linked in the docs, so completely skew the upvotes new feature New feature or request plan: Premium Impact at least one Premium user v6.x
Projects
MUI X public roadmap
Recently completed
Development

Successfully merging a pull request may close this issue.