Fill document from a google spreadsheet - forms

I have a web form that populates a Google spreadsheet.
My question is can I populate a document with some or all of the information from a given row ?
Example: I created a webpage for a small business that they can input all the details from a sale. That populates a google spreadsheet. Now I need to create a nice looking receipt (document) that includes the information from some of the fields in a particular row of that google spreadsheet to print out and give to the costumer for them to sign

I coded a simple java script library todo the same thing after hours of search. (Wish I started it right away) Gsheet2json
Upto now it can get data from the spreadsheet as objects array or arrays of array and you can use any template you want to publish it(of cause using your own java script + html).

Related

Trying to write App Script for sheets/forms to automate email response

I have a form and sheet but I'm not sure which is better to use to pull data from or create the trigger of form submit.
I am trying to create an email response to a form that is based on a google doc with images and text and will pull the name and responses from the form (or sheet).
Here are the work files. I will need to add this script to a different form/sheet later.
https://drive.google.com/drive/folders/1MhHOPjMD0JwVgP98majrKBPk-Cf1_Uwn?usp=sharing
There is actually an existing template for something related to what you are asking for in this Google developer documentation https://developers.google.com/apps-script/samples/automations/content-signup where you can easily make a copy of the file and change the values based on what you need.
This is basically allowing you to send emails from a trigger "onFormSubmit" based on what people filled in the Google form. Please let me know if you actually need the full code though! Or what exactly you are trying to achieve if the template is not working for you.

Google Apps Script - Submit PDF Form Data (Image)

Is there a Google Apps Script that can retrieve form data from a fillable pdf form and export it to my Google Drive when I click submit form? I don't need the complete document to be exported, it's only a selected field (image-field) that I particularly need to be exported. I am working from Adobe Acrobat Pro. I'm sorry I have no code to show what I have tried so far because I am a novice in this.
Updated:
According to Adobe, submitForm () function is one of the most flexible ways of moving data in and out of a form as it uses GET to send or receive data from a web server. Where the submitForm () has a variety of input arguments for just about any data format from the entire pdf to images.
One forum (on Adobe Library), raised an exact question, and a brief response provided to look into Google Apps Script. I found a similar question on stack overflow - the user wanted a form submission from their Site to GDrive Spreadsheet using GAS. Whereas I have a standalone PDF form, and on form submission, I need the (image) data from the pdf form exported to my GDrive Folder.

Is there a way to create an output form based on Google Sheets data?

What I want to make
Is this possible?
I'd like to create an output form that reads data from a Google Sheets spreadsheet. In the form, users would enter a few values (entering their name and some ID number, for example) and view the corresponding information in the connected spreadsheet but not any other information in the sheet. Something like an output form in Microsoft Access. I'm hoping there's a way to accomplish this in Google Sheets using existing tools and maybe some scripting.
More generally, though, any way to create this type of 'limited visibility' on a per-user basis for Google Sheets data would be useful. (The 'protect sheet' function in the menu doesn't accomplish this; see below.)
For reference, my specific use case at the moment is as a teacher and wanting a way for students to see specific information related to them from my student information spreadsheet but while not revealing other students' information. I would have a simple form where they enter a name and maybe some personalized code that I give them so they can see their attendance record or something else. For my purposes, I don't need the form to be extremely secure as none of the information is all that sensitive (although more secure is better), but I don't want to be just putting all the information there in front of them by giving them access to the entire sheet.
What I've tried so far
I made a new spreadsheet file with two sheets; one sheet was visible to function as a form, and the second sheet was not visible (which I accomplished via the 'protect' menu option). I used importrange() to read in the relevant data from my primary spreadsheet to the new spreadsheet's non-visible sheet. On the visible sheet, students entered their name from a drop-down and entered their student ID as validation. If the student's name and ID matched, the first sheet did a vlookup() to read in information from the protected sheet and some information from their student record.
Here's what I made, in case my description doesn't make sense: https://drive.google.com/open?id=1cHO2jzMh1mkXvlLh-M4eYqN7v11t95-GnfWqL5IwQ14&authuser=0
This had two problems, one small and one big.
The small problem was that every student could see the "form" sheet at the same time. If two students opened the spreadsheet at the same time they would see any information that the other student had entered. I handled this by writing a simple script to automatically reset the "form's" input cells after 20 seconds. Also, any time the form was opened by a new person, the "form's" output cells were erased. So, obviously not a brilliant solution, but for my purposes, this was mostly good enough.
The big problem was that Google's own preview viewer (built into Google Drive and the like) ignores protected ranges and sheets and displays the entire contents a spreadsheet. (Normally, protected sheets are not visible at all and don't appear in the list of sheets at the bottom of the screen unless the viewer has access to them.)
In my case this meant included the protected one that shouldn't have been visible at all, rendered as if it were a print preview, meaning the students were actually able to view all of the other students' data in one big table.
Are you familiar with Web Apps?
An Apps Script Web App allows you among others to output selected Google Document contents into a browser.
Hereby, you can use the method Session.getActiveUser() to obtain the email of the user and dynamically adjust the data the user is going to obtain in function of his email (BTW, you can also use Session.getActiveUser() in the spreadsheet, to detect the user automatically instead of asking him for his name).
Simple example workflow:
Replace in column A student names through student emails (the Gmail addresses with which the users authenticate their sessions and access Google Sheets)
Bind to the spreadsheet a script with a content similar to the following:
function doGet(){
var ss=SpreadsheetApp.getActive().getSheetByName('Data');
var range=ss.getDataRange();
var values=range.getValues();
var user=Session.getActiveUser();
var output="";
for(var i=1;i<ss.getLastRow();i++){
if(values[i][0]==user){
for(var j=1;j<ss.getLastColumn();j++){
output+=(values[i][j])+" ";
}
}
}
return ContentService.createTextOutput(JSON.stringify(output));
}
Make sure that you have a doGet() function and a return statement.
After running the script once manually to trigger authorization flow, deploy it as a Web App - executing it as User accessing the web app and giving access to Anyone (unless desired otherwise).
Copy the URL of your WebApp and forward it to your student.
When the student open the URL in their browser - they will obtain their results - provided their email is listed in the sheet.
Please note that the code provided is a simple sample, that retrieves
all data and outputs it as a string. Feel free to modify the script
e.g. retrieving only columns of interest and outputting the data as a
html table, rather than a simple string.

Prefill Google Forms spreadsheed with results from other sheet

I've tried figuring this out but without success until now, I want to create a new Google Forms spreadsheet, and already fill it with some data.
The reason I want this is because at this moment I have one spreadsheet with info from 2015, 2016,2017 and I want to split it to each quarter to view the responses, including the nice charts.

Creating a pay slip in PDF format using progress 4gl and email to employee

I have a requirement to create a pdf file that includes the salary slip details like (DA,HRA,Basic,Leave taken.... etc) by taking a leave taken as an input value from update able browser and generate a report in form of pdf that will be send to employee as well as bank to get credit the amount to thier respective salary account.
If you're trying to create a PDF document from within Progress, you can use PDFinclude (a Free Libre Open Source Software piece of code) to do so. See http://www.oehive.org/pdfinclude to get started.