Leila Etaati shows how you can use R to export data from Power Query to disk or to SQL Server:
There is always a discussion on how to store back the data from Power BI to local computer or SQL Server Databases, in this short blog, I will show how to do it by writing R scripts inside Power Query.
Leila also describes a complication you may hit where writes happen twice.