If your team uses a database (PostgreSQL or MySQL) as your source of truth, it can be difficult to keep the data up to date with your various systems, not to mention time-consuming.

Updating the data within your Google Sheet and pushing those updates directly to your database using the “Export to…” feature can now make bulk updates to fields/tables within your database a breeze.💨 With actions, Update, Insert and Delete, records can be managed directly from Google Sheets without having to write additional queries.

What is Export to SQL?

“Export to SQL” is a Coefficient feature that allows you to connect your database, pull your data into Google Sheets, update the values and push those updates back to your database without the hassle of writing complicated scripts.

🚨⚠️Note: You need to use your own database connection with Coefficient to push data from Google Sheets into your database using Coefficient. Shared data sources are not supported with this feature due to security reasons. 🚨⚠️

How to Export to SQL?

<aside> 💡 We recommend doing an import of the data from your database into Google Sheets prior to using the “Export to SQL”. This allows us to automatically detect/map certain fields, rather than you having to map every field manually.

</aside>

******For this example: We’ll use an existing MySQL import and INSERT a new record to the film table.

  1. Click “Export to…” from the sidebar.

Untitled

  1. Select the data source you would like to push the data back to. So in this case, “MySQL”.

Untitled

  1. Select the Tab (dropdown) in your Workbook that contains the data you want to use and the Header row that contains the column headers from your database.

Untitled

Note: Coefficient will automatically select the Sheet you have open as the Tab for this Export. If it is a different tab, you will need to click the drop-down and select it.

  1. Designate the Table in your database that you are updating. Then pick the appropriate Action from those listed for the data.

    Untitled

  2. Complete the Field Mappings for this Export. Coefficient requires a Primary Key or ID field to be mapped for certain Actions (UPDATE and DELETE) so that the updates made are to the correct records in your database.

    Untitled