Modifying data

Editing data

To modify imported MySQL data, click Edit Mode to start an editing session.

If the time since the last import or refresh exceeds the Outdated time interval, the add-in warns that the data may be outdated. The available actions depend on the Refresh data before activating Edit Mode setting:

  • If selected, click Yes to refresh the data before editing, No to edit the existing data, or Cancel to leave Edit Mode inactive.
  • If cleared, click Yes to edit the existing data or No to leave Edit Mode inactive.

Configure this behavior in the Check whether data is outdated group under General settings.

Edit Mode is unavailable if the imported table has no editable columns. When Advanced Edit Mode is enabled, it is also unavailable if another table occupies the same columns. If the imported table has no columns that uniquely identify rows, the add-in warns that changes may be applied to the wrong rows or may not be applied.

Edit the imported data using standard Excel operations. By default, modified cells are highlighted in pale yellow.

Note

You can change the highlight colors on the Appearance page of the Options dialog box.

Adding rows

To add a new row, enter the required values in the empty row at the bottom of the imported table, highlighted in green by default, and press Enter.

Alternatively, you can insert a row using standard Excel commands:

1. Right-click the row number where you want to insert a new row.

2. Select Insert. The new row is highlighted in yellow by default.

3. Enter the required values in the new row.

By default, Devart Excel Add-in for MySQL underlines cells that require a value. You must fill in these cells before the new record can be saved to MySQL.

Click Commit to save the new rows to MySQL.

Note

If filtering is enabled in Edit Mode, the empty row for adding records may be hidden unless the filter includes blank values. To keep the row visible, include blanks in the filter.

Deleting rows

To delete a row:

1. Right-click the number of the row you want to delete.

2. Select Delete. The deleted row is highlighted in dark yellow by default.

Click Commit to delete the corresponding record from MySQL.

Using formulas

You can use Excel formulas with imported MySQL data.

To use formulas:

1. Import data from MySQL into Excel.

2. Select the cells where you want to enter formulas and change their number format from Text to General.

3. Enter the formulas.

4. Click Edit Mode to start an editing session.

Note

Do not refresh the imported data after entering formulas, as refreshing may overwrite them with values from MySQL.

5. Modify the cells referenced by the formulas. The calculated values update automatically.

6. Click Commit to save the changes.

Data validation

Devart Excel Add-in for MySQL validates data when you modify existing records or insert new ones. It checks whether the entered values match the data types and constraints defined in MySQL.

For example, if a column requires a numeric value, entering text or a date triggers a validation warning.

Validation message for an invalid data type.

The add-in also validates data length, date and time formats, and other applicable constraints.

For columns that require unique values, such as an ID column, the add-in checks for duplicates and displays a warning if a duplicate is detected.

Validation warning for duplicate values in a unique column.

Applying changes

After editing the imported data, click Commit to save your changes to MySQL.

To discard your changes, click Rollback. This restores the imported data to its state before the uncommitted modifications.

After committing or rolling back changes, you can continue editing or turn off Edit Mode.

Note

To keep the editing session open after committing or rolling back changes, select Continue after commit or rollback in the Edit section of Options.

To modify data from another MySQL object, click Get Data, select the required object, and adjust the query if necessary. You can then import and edit the data using the same procedure.

Checking for concurrent changes

If concurrency checking is enabled, Devart Excel Add-in for MySQL checks whether another user has modified the same records since they were imported.

If concurrent changes are detected, the add-in displays a notification and allows you to either roll back your changes or commit them anyway.

Committing your changes despite a concurrency conflict may overwrite changes made by another user.

You can enable concurrency checking in the Error Handling section of Options.

Error handling

By default, Devart Excel Add-in for MySQL does not display generated SQL statements before applying changes.

To review the statements before execution, enable Show SQL in the Error Handling section of Options.

The Show SQL option.

When Show SQL is enabled, clicking Commit opens the Execution dialog box, which displays the INSERT, UPDATE, and DELETE statements generated for your changes.

For example, the following modifications:

Modified data in an Excel worksheet.

Generate the following SQL statements:

Generated SQL statements in the Execution dialog box.

To apply the changes, click Execute in the Execution dialog box.

The add-in executes the generated statements against MySQL, updating the corresponding records.