Is there a way to paste multiple rows on an editable grid like if it was excel?

Need somewhat of an excel functionality.
Copy and paste multiple rows from clipboard and Update a whole column.
Is this possible with the editable grid?

Hello!

Could you clarify what do you mean by editable DataGrid? DataGrid that has generated columns with field or DataGrid with the inline editor?

There are two issues can be faced: how to get content from the clipboard and how to parse it.

Using JS we can get clipboard’s content, but it requires user permission (Clipboard.read() - Web APIs | MDN). The browser will show a dialog with a permission request.
JS code we can write in com.vaadin.server.AbstractExtension (see JmixCopyButtonExtension, JmixPivotTableExtension).
Then we can create an action in the table with CTRL-V shortcut and place the extension here.

After we got data from the clipboard, we should understand how to parse it. And there can be a problem. For instance, if we copy the text of some rows from DataGrid, the column values will stick together, and only rows will be separated. However, text copied from an Excel file seems to be parsable.

I think it is not a convenient solution as it always shows permission request dialog and needs to parse not structured data, but I don’t see another way.

Thank very much for your response !!
Just like google docs spreadsheet… copy from MS Excel to the Google Spreadsheet.

I need people to be able to copy paste data from excel to a web based spreadsheet… like google spreadsheet… run validations and fix on the standard UI form.

So you need feature like Data import – CUBA Platform add-on but with copy-paste.

I think there is another solution. Instead of pasting data to the DataGrid, we can show the dialog with an integrated spreadsheet. There the user pastes data and saves it. Before closing the dialog, we can read data from a spreadsheet and convert it to an entity. However, it is needed to find a JS library, investigate the API and integrate it into the application.

Thank you for your reply. Copy paste like google spreadsheet is what Im looking for. Any idea of where to look for this JS library?

You can start to search with “js spreadsheet”.

Additionally to my second solution. I meant that the spreadsheet should be used only for pasting data. Then data should be converted to entities and shown in the DataGrid.