It would really be useful to have embedded within DataGrip, IntelliJ's Database Explorer, etc. the ability to export directly to Excel. Please vote for https://youtrack.jetbrains.com/issue/DBE-4123
As I explained in my comment in that YouTrack ticket, exporting to CSV and then importing into Excel messes SQL results up in several ways:
1. Excel interprets all strings of digits in CSVs as numbers -- even if they're stored as strings in the SQL database:
* Some of our inventory are tracked by 14-numerical-digit cellular MEID / IMEIs. We store those as strings in our SQL database. When we do a SQL query for those strings, then export to CSV in DataGrip, Excel interprets the 14-numerical-digit strings as numbers -- and displays them as scientific / exponential notation -- instead of interpreting them as strings.
2. Excel chops off the leading zeros of numbers stored in CSVs:
* Again, some of our inventory is tracked with serial numbers that have leading zeros. We store them as strings in our SQL database. When we do a SQL query for those strings, and then export to CSV in DataGrip, Excel interprets the strings as numbers -- and chops off the leading zeros.
That's above and beyond the annoyance of having to do 3+ steps instead of 1:
1. Export to CSV
2. Open in Excel
3. Correct cell formatting errors (due to the above issues as well as others)
4. Save as XLSX
1. Export to XLSX
Again, please vote for https://youtrack.jetbrains.com/issue/DBE-4123 to help raise the priority of this feature.
Thank you for your assistance!