I've been coding with PHP, HTML and CSS for a while now. Just started looking into Google Apps Scripts for creating a custom Add-On. I've been searching for a while but have been unable to find an answer.
Is it possible to get the text from a user-created table (one that was inserted using the Google Document drop down menu)?
Documents are build with specific elements, it is quite easy to find a table and, from there, retrieve its content.
See in this post answer (Henrique's answer) a script that iterates a doc to see how to do it.
This answer is quite "general" but your question was too... be more specific if you need more specific informations.
Related
I have a template Google Doc with linked tables and charts that I need to programmatically update so that I can export it as PDF and send by email. I haven't found a way to do that neither with apps script nor google docs api. And I really want to avoid updating the template with static content.
I know this question has been asked before, but never has a positive solution been found.
If this is still not possible, maybe there is a work around? Like a chrome extension you can trigger that can simulate manual update? Or whatever. Doesn't have to be elegant or anything, just has to work somehow.
Thanks a lot for your help.
I would like to use Google Forms to assign categories to a list of sources in Google Sheets. I want to use Google Forms in specific because I need to create a pipeline for a group of people that is not familiar with programming. Google Forms is easy to use while still leading to a highly standardized output that I can subsequently import into R and analyze. Furthermore, Google Forms provides a better display of large amounts of texts (around 200 words) than Google Sheets.
Ideally (and taking into account Google Forms' relatively limited functionality with regard to using answers to previous questions to dynamically show next questions), I'm looking for a structure that looks somewhat like this:
Question 1: Manually provide number of source that you want to categorize.
Use answer to Question 1 to display title source and description of source as text, which are pulled from a row in a Google Sheet that corresponds to the answer to Question 1.
n questions about the source that is displayed, which are always the same (thus static).
Submit form (and show option to submit another response).
The answers to the questions should be automatically written to a Google Sheet, with columns for each question and a new row for each submitted form (just like usually would happen for a Google Form).
Although I don't think the set-up is very difficult or sophisticated, I'm struggling with how to get this to work - definitely due to my inexperience with using Google Apps Script, and not knowing the exact limits of Google Forms' functionality.
Questions
If possible, how can I create one form (prob. using Google Apps Script) that performs step 1 to 4? If this is entirely impossible to use previous answers for subsequent answers in Google Forms, how can I create a form for step 1 (again prob. using Google Apps Script), which then automatically redirects people to a second form for step 2 to 4, based on the answer on the first form?
I want to scrape this specific information "NM_000014.5" from the RefSeq transcripts table (to be more specific I'd like to have the RefSeq Select one) of this website https://www.ncbi.nlm.nih.gov/gene/?term=%22A2M%22+human
I want to scrape this information using Google script in order to add it to a Google sheet table. I have already been able to scrape other info but this specific information is too hard to get for me. I tried to use UrlFetchApp.fetch and parsing with XmlService but it seems that this info is linked to another website...or something like that...is there a "simple" way to get that?
You could try using the IMPORT functions that come with Google Sheets -- specifically, either ImportXML or ImportHTML. These are great options that I have used in the past for simple site scrapes.
Here is a great article covering basic web scraping in Google Sheets with ImportXML: https://www.benlcollins.com/spreadsheets/google-sheet-web-scraper/
Just right-click Inspect the site for the correct HTML tags. Hope this helps a bit
I want to create an app which helps newbie employers to take some simple decisions. So, using their answers to a form, the app asks new questions based on previous responses, something similar to a decision tree. Is Google Form a good alternative to implement this? (something like this suggested here, but with more questions:
Are there alternatives based on Google Apps Script?
What you need is a Google Form with a lot of questions, whose answers redirect to different pages in the Form.
You can also use Google Apps Script Forms Service to create Forms through code (and you can use previous responses in old Forms to generate new content for new Forms dynamically).
A typical example of this would be:
Create a Google Form with several questions with redirects based on answers (decision trees).
Have the responses to that form go to a response Spreadsheet.
Run a script on the response Spreadsheet to generate new content using the Forms Service within Google Apps Script (or do this manually; both work).
Send out the new Form to employees by email (you can use Gmail Service to accomplish this) or however you prefer.
--> and repeat the process as needed.
At my work, I use Google Forms with redirects and scripts on the response Spreadsheets in order to process faculty requests using Google Apps Script, so this is definitely possible!
However, it should be noted that Google Apps Script cannot be used to dynamically generate content for Forms while the user is filling it out. See my question here.
I don't feel like typing a mass of code here, but there are two ways of accomplishing this (both of which would require a lot of script code):
You could potentially accomplish this by making a web app that automatically dumps the responses into a spreadsheet (limited space) or a document (which doesn't have to be human-readable). This won't give you the same UI, but it would work, assuming you are familiar with making web apps in the first place.
You could make a multi-page form that you could write some code to direct the person upon selection of whatever choice they make to go to the correct page. This other question may serve of use if you want to go this route (it likely will be a bit easier).
I have a Google Form that feeds a Google Docs Spreadsheet. I'd like to--in turn--have that Google Docs Spreadsheet feed a webpage.
In plainer English, babysitters fill out the form to sign up to be in our community's Babysitter Directory. The spreadsheet houses all of the data. I'd like to code a webpage to pull selected bits of the data for the online directory.
I've tried doing a separate sheet in the spreadsheet, using a QUERY to select the columns that I want to include (and the order in which I want to include them), publishing that sheet to the web, then embedding that sheet into the webpage in an iFrame. And that works.
But even with the QUERY, there are SO many columns that users need to scroll WAY over to the right to see all the data for each babysitter. It's unwieldy.
What would be way better would be if I could break the data for each entry over multiple lines and do some nice formatting for a directory, rather than just a linear spreadsheet. So that, essentially, each babysitter's "entry" in the directory is more than 1 line long. Does that make sense?
If I was working in Office, I would know exactly what to do: use the Excel spreadsheet as the datasource for a Word Mail Merge and I would put move the fields around on the page to make it all look good.
And, to be sure, if I can do this in a Google Doc, then embed the Doc into the webpage, that's fine, too. But I would think there's some way I can do it directly in the Google Site?
Can I?
If anybody has even just a reference page for me to take a look at, I'd appreciate it.
Thanks!
Are you trying to do this in Google Sites? If so, you can embed the entire spreadsheet on the page, but if you only want certain columns, you can try inserting an Apps Script widget on the page.
You need to know how to write a Google Apps Script that will run JS functions and render HTML, here is a tutorial
To create the Script that can run on your page, go to:
More > Manage site > Apps Script > Add new script
Here's also a link to how to interact with Spreadsheet data.
What you want to do is more or less a database interface that uses a spreadsheet as 'data holder', depending on your programming skills it can be quite easy or very hard...
Here is an example of such a webapp, its has probably too many fields and features but the general idea is the same (a quick search tool and a window to show results).
It that what you had in mind ?
If so I can share the code to help you to get started but if you are not familiar with javascript it will probably need too much effort to get through.