Automate SQL to run and populate a spreadsheet

[expired user #10761]'s profile image [expired user #10761] posted 7 years ago in Running SQL scripts Permalink

Morning All,

I need to automate a piece of SQL which will run and then populate a spreadsheet on the 1st of every month. I am fairly new to HeidiSQL, so wanted to check if this is even possible?

Would be grateful for any advice on how this can be set-up.

Thanks

[expired user #1502]'s profile image [expired user #1502] posted 7 years ago Permalink

Run your query in heidi, then RMB (Right Mouse Button) over result grid and click 'Export grid rows'. Check 'Copy to clipboard', 'Excel CSV' & Complete row selection and hit OK. Now you can paste the copied data into your Excel. Alternatively, you can skip clipboard stuff save data directly to .csv file that will be opened in Excel just fine.

[expired user #10761]'s profile image [expired user #10761] posted 7 years ago Permalink

Hi,

Thanks for the response.

I am looking to get all of this done automatically every morning on the 1st of the month. I need to remove the manual work.

kalvaro's profile image kalvaro posted 7 years ago Permalink

HeidiSQL is a GUI tool; it addresses an entirely different use case. The whole point of graphical interfaces is precisely making manual work easier.

[expired user #1502]'s profile image [expired user #1502] posted 7 years ago Permalink

Yup, Heidi is for different purpose.

You can use mysql cli to execute query and save results into csv file: https://dev.mysql.com/doc/refman/5.7/en/select-into.html

Then put it in cron/scheduler.

[expired user #10761]'s profile image [expired user #10761] posted 7 years ago Permalink

Thanks guys, will do some research on cron/scheduler

Please login to leave a reply, or register at first.