I would like to build an "Agreement Generator" for my business that is based on Google Docs Templates. I have a Node.js app that calls the Google Drive REST API v3. Here's how I'd like to do it:
Get a Google Document's raw content
Replace every ${variable_name} with value in that raw content (value is provided from an HTML form)
Update the Google Document raw content
I have been wrapping my head over this for days and I just can't find out how to get a Google Document's raw content.
It seems that all I can get is metadata. Other than that, I was thinking of maybe using the drive.files.export() method to get a Word document (to keep formatting and layout) then read it with Node and replace the values. But then I would have to re-upload that Word file and manually re-convert it to a Google Document from the Drive UI.
So I'm stuck there! Has anybody ever done something like that? Please help :)
I'm trying to embed these pages into my website.
http://globalnews.ca/regina/feed/
http://weather.gc.ca/rss/city/sk-32_e.xml
I'm not sure exactly how these pages are supposed to work. Are these pages only used for scraping data? I'm not sure how to get the information from these XML/RSS feeds?
After some more search I discovered that I need to parse them XML in some fashion. I am using PHP so my first step is to use
simplexml_load_file('http://weather.gc.ca/rss/city/sk-32_e.xml');
and then read it from an array.
Use Google Feed API. It's pretty simple to get to work, and only needs Javascript.
https://developers.google.com/feed/v1/devguide#getting-started
I have a website and want to have links to a page which has a filter function. I would like to create a link in such a way that when followed I do not simply get the destination page, but rather the page with a filter already applied.
To be more specific I am looking at the website for NetCDF CF standard names. From my page I would like to have link that would already filter e.g. for 'longitude' on the destination page.
The destination page is using javascript to apply the filter function.
Any ideas how to achieve that?
It's impossible to control a JS on a site from an external URL.
But you can do a something else: Download the data from the external site to your server via a server-side script (like php), and recreate the filters on your site in JS. But this way you should care about copyrights and you have to maintain your script if they changed the table structure they used.
I've seen numerous articles on this but they seem outdated, for instance none of the Google Docs Spreadsheet urls has key parameter. I read this as well:
JSON data from google spreadsheet
Then I read this to access data
https://developers.google.com/gdata/samples/spreadsheet_sample
My spreadsheet exists at:
https://docs.google.com/spreadsheets/d/1SKI5773_68HiSve1fsz7fr4gotjFWHB7KBuVsOlLz6I/edit#gid=0
I've tried using this code, I think I have a problem with the key or syntax, please guide to fix.
<script src="http://spreadsheets.google.com/feeds/feed/1SKI5773_68HiSve1fsz7fr4gotjFWHB7KBuVsOlLz6I/worksheet/public/basic?alt=json-in-script&callback=importGSS"></script>
<script type="text/javascript">
function importGSS(json) {
console.log('finished');
}
</script>
The src attribute in your script tag is an invalid link (and you can see this for yourself by viewing your link directly in a browser).
The feed/key/worksheet section of the URL has the right key but the wrong feed and worksheet.
In the URL, replace "feed" with either "cells" (separate value for each cell) or "list" (separate value for each row).
At the same time, replace "worksheet" with "od6" (indicating the leftmost, or default, sheet - see this blog post for accessing other sheets).
If you view this new URL directly in a browser, you can see that it returns a meaningful value.
Your final script tag might look like this:
<script src="https://spreadsheets.google.com/feeds/list/1SKI5773_68HiSve1fsz7fr4gotjFWHB7KBuVsOlLz6I/od6/public/values?alt=json-in-script&callback=importGSS"></script>
For more info, you can see an example on the Google Developers site
APISpark PaaS has a feature to create and deploy a custom JSON API based on a GSpreadsheet. That might help and give you more control on the web API (CORS support, authentication, custom domain and so on).
See the tutorial here: https://apispark.com/docs/tutorials/google-spreadsheet
You may consider use an alternative to this request of your sheet data, because this method is deprecated.
Anyway, you can still using another feed format, you can see this alternatives in:
https://spreadsheets.google.com/feeds/worksheets/your-spreadsheet-id/private/full
In that result you can see any export formats are availables. Can help you an CSV or alt JSON visualization format?
Another potential solution here is to use this https://gist.github.com/ronaldsmartin/47f5239ab1834c47088e to wrap around your existing spreadsheet.
Add the id and sheet html param to the URL below.
https://script.google.com/macros/s/AKfycbzGvKKUIaqsMuCj7-A2YRhR-f7GZjl4kSxSN1YyLkS01_CfiyE/exec
Eg: your id is your sheet id which is
1SKI5773_68HiSve1fsz7fr4gotjFWHB7KBuVsOlLz6I
and your sheet which is
Sheet1
In your case you can actually see your data (it's actually working) here as json at
https://script.google.com/macros/s/AKfycbzGvKKUIaqsMuCj7-A2YRhR-f7GZjl4kSxSN1YyLkS01_CfiyE/exec?id=1SKI5773_68HiSve1fsz7fr4gotjFWHB7KBuVsOlLz6I&sheet=Sheet1
To be safe, you should deploy the code sheetAsJson.gs in the github gist above as your own in your Google Drive.
You have plenty of possible answers above. For those that come anew, if you're looking for a more controlled JSON generator, check out this gist:
JSONPuller
It takes in a Spreadsheet and returns an array of objects, with the lined that you decide as the headers (defaults to whichever line is frozen)
Cheers,
The easiest way for me was to export spreadsheet to CSV
File -> Download -> Comma-separated values
Then just convert CSV to JSON with free online servic
I'm building a user dashboard in Django for a python based web service. This web service creates emails, and the HTML strings of these emails are saved in a file (and could theoretically also be saved in a db table). As part of the dashboard functionality I want to be able to preview the email, essentially rendering the html string of the email within the Django html view. Is it possible to do this? Will I need to work with a Javascript library to achieve this? Which one? Any help would be very appreciated!
EDIT
To clarify, the html string when put into a text editor is about 360+ lines. It has its own styling and it's own <head>, <body>, etcetera, tags. I want to display it like a webpage within a webpage, if that makes sense, so that it looks like a proper preview. I just have no idea how to do this, my experience hasn't really been with js or front end dev.
make the email html available like any other page and display it inside of an iframe.
be warned - email clients don't use the same rendering engines as browsers. its hell. (we use this - https://litmus.com)
Nothing more but:
document.getElementById('IDofDisplayContainer').innerHTML = 'your mail HTML string';