How to Pass results from Google Forms to Google Data Studio using Google Apps Script? - google-apps-script

I've been working on Google Apps Script for the past few days, a friend of mine created a template of PDF in Google Data Studio. We also have a Google Sheet that came from the Google Forms result. Here are the questions I want to resolve.
When the user submits the form, I want the record of that submitted form to populate the Google Data Studio PDF and export it as PDF using Google Apps Script
(just that single record to create a PDF every time the user submits.)
I want to use Google Apps Script to get every record in the existing Google Sheet to populate the Google Data Studio PDF Template and export it as PDF.

You cannot use Apps Script to interact with the Data Studio interface in any way. It is currently not possible.
Again, you cannot use Apps Script to initiate the PDF export. However, if all your data is in a Google Sheet, you can just build a dashboard off that in Data Studio and manually export the PDF. As your data gets updated, dashboard will also get updated. You can initiate the PDF export manually whenever you want.

Related

How can I prompt a user to save the newly auto-created google doc to a google drive location of their choice

I've created a google apps-script script to create a google document report based on the filtered options in a google sheet. The report generation is started from the google sheet.
I can create the required google document report but would now like to prompt the user to save it to a specific google drive location of their choice using the google drive Move To menu option. When the report is generated, I'd like a prompt to appear stating "Save Report to.." and the user is then displayed the google drive prompt as per this example
and can then select where they want to save it on google drive. Any and all help appreciated.
If the google drive menu options are not integrated, is there another way to prompt the user so they can select which location to store the doc?
Very few built-in user interface menu options are integrated with Google Apps Script, actually most built-in user interface dialogs can't be open by using Google Apps Script but you might use the Google Apps Script HTML service to build your own dialogs.
To help you create your own dialog to handle files in Google Drive you might use Google Picker.
Resources
https://developers.google.com/apps-script/guides/dialogs#file-open_dialogs

How can I open the print window (export to pdf) via Google App Script?

I have a script that created a menu in a spreadsheet. When I click on the menu option, it asks for what line I want to print and it sets the data in another sheet (formatted for printing). I want to be able to open the print window of one of my sheets. Is there any way to achieve this?
I don't want to export the pdf automatically because I want to be able to choose the printer and the page format.
Thank you
This functionality is currently not possible in Google Apps Script. There is no option to automate opening the print dialog.
As a workaround, you could programmatically export the Sheet you want to print as a PDF and use Apps Script's MailApp to mail it to your printer.
If you are still interested in this feature and would like to communicate it to the Google Sheets team, I suggest you create a Feature Request in the Google's Public Issue Tracker.

Google Apps Script : Download PDF responses from Google Forms

I have created a Google form with few responses. I want to download those responses as PDF format into my local pc using a script run by Apps Script. I can't find any apis in Apps Script to do so.
Any ideas? Thank you.
When you have a Form, it will save your responses in a Sheet, as described here. You can export that sheet as PDF following step 2 in this tutorial using the UI.
If you want to use GAS, you can follow this tutorial, to show you how to create an add-on for it. You can also follow this answer to get a single sheet as a PDF.
However, I believe the suggestion of doing it with the UI will work best for you, since each form has only that Spreadsheet associated to it, and it will have only one sheet.

How to get filtered data from Google Data Studio to Google Sheets for Printing?

I'm trying to print all of the information in a Google Data Studio report which is something that is annoyingly missing from GDS. The data comes from a Cloud SQL database, and I would like to print a subset of it based on user filtering. I was hoping to use Google Data Studio to manage that filtering, as well as the printing, but I am not sure if I will be able to use it for either purpose.
Does anyone know how to easily print all of the information from a Google Data Studio report, or at least know how to export it to sheets with Google Apps Script? I would like to use Google Data Studio to manage user/data interactions, but at this point am planning on building a custom menu through Apps Script to facilitate basically the same purpose as Google Data Studio in Google Sheets.
Does export to CSV work for your needs?

Managed and save google apps script projects from spreadsheet

I have developed few scripts in a given project attached to a spreadsheet (ie that I first created my spreadsheet, and then created the project with the menu Tools>Script editor).
Now my question is:
how can I save that project so that it can be used on other spreadsheets?
how do I select in a given spreadsheet which script project I want to use?
From this Google documentation page I can't see any solution.
To have a script that's not bound to any document, look into making a standalone script.
If you want to use a script in multiple documents, you'll need to publish it as a library.