create a dynamic html file and execute it in google apps script - javascript

I'm trying to migrate various Excel applications to Google Apps. These generate html and javaScript based on various excel data and parameters to create a local html file which is then opened by a browser.
I know it's a long shot, but can anyone think of a way to mimic this behavior in Google Apps Script? Namely - create a file on the client and fetch it up in a browser session.
Here's an example of the type of application I mean

You can use DocsListApp.createFile to create new HTML files on the user's Google Drive, but I don't believe you can serve the HTML from Drive directly. Alternatively you can use the SitesApp to create a new page on a Google Site with the HTML you want, using Site.addWebPage. Finally, you may want to look into the widgets available in UiApp or the UI Builder, to see if you can use those instead of custom HTML.

Just saw this:
https://googledrive.com/host/0B716ywBKT84AMXBENXlnYmJISlE/GoogleDriveHosting.html
HTML files uploaded to Public Google Drive folder are served as HTML, link is available through "Preview" button.
So far it doesn't work with Google Drive files simply moved to that folder but perhaps would work with files created there via createFile script.

Related

Create .MSG or .OFT Outlook Files From HTML (via JavaScript)

The Need:
Essentially I have a tool that creates HTML Emails. A feature I would like to add for this tool is to create .MSG or .OFT files for use specifically in Outlook so the client doesn't have to load the HTML into outlook and create their own .MSG or .OFT files manually. This has to be done in either PHP or JS via my tool, NOT done manually in Outlook.
The Problem
It appears these files are Binary Files and I cannot find a JS Library that handles the conversion. If the client uploads the HTML directly into Outlook, then Outlook modifies the HTML in such a way that it often breaks the email. If I had more control over the conversation I could hopefully fix a few of the rendering issues.
What I've Tried
I exported .EML Files successfully, but once imported into Outlook and converted, these too break in the same manner as straight HTML.
Any thoughts greatly appreciated.

Save data in a local file with HTML, Javascript?

I'd like to develop a simple offline html page to track my working hours. I'd need an offline file where I can put all my information and then retrieve them through Javascript. What do you suggest me? XML, Json, a DB? I need a "physical" local file because I would like to take my folder with all my html, css, and js files, put it in a pen drive and then open it in another computer. So something portable.
You can't do that offline; HTML/JavaScript doesn't have the ability to write to the filesystem. You can create cookies or use .localStorage in JavaScript, but that would only be local to your browser and won't be visible on another computer.
The closest thing you could possibly get is to write a page that stores data in localStorage and then run it from a portable version of your favorite browser that you also keep on your portable drive.
If you are not set on only using HTML, you might look into doing a C# windows form application.
You can find more on how to leverage that StreamWriter Class here:
https://msdn.microsoft.com/en-us/library/system.io.streamwriter(v=vs.110).aspx
However as for file type, a local JSON or .csv file should do the trick.

Possible download / upload manager embedded on html page with access to local filesystem

As the title indicates i want to have a certain application get access to the local file system. To describe why i will illustrate my situation:
I am a running a IIS WebApplication with the C# MVC 4 Framework as backend module. The site solely consists of HTML, CSS markup and some JS. The page will be loaded in IE11+ (Edge) only. For the standard procedure of displaying and accessing data from as well as sending data to the server this works quite fine.
On a certain page I want the user to be able to upload a file using a simple file dialog, like the one you can initiate with a simple <input type="file"> tag. I also want to offer the posibility to download files from the server but need to know where files has been saved / will be saved to.
As described on a lot of different websites, just like this one here, the HTML5 File API does a great job but will not be able to return the full qualified filename including the local path directions, same for JS accessing the file object.
As my research confirmed HTML5, JS and also SWF (Flash) will not report detailed information because they are all sandboxed applications or restricted by RFCs. I already unterstood and appreciate the effort to secure my trips to internet.
But in this case do need the paths where a file was upload from and the file has been downloaded to.
So my question is, what is the best way to expose the full path directions for a up- as well as downloaded file to report them back to the server?
Is it possible to embed a SWF object inside HTML which will run inside an Adobe AIR sandbox or is a signed JAVA Applet still the one and only solution to accomblish this security breaking task?
A solution i would also apreciate would be the possiblity to ask the user to get access the file system, like you grant access to the web push service to receive notifications.
Also if there is a possible solution which may suite my circumstances please let me know by adding some simeple examples / revealing some factful links, thanks in advance.

Want to Develop a Web Page which will Upload and Delete File from Google Drive

I am trying to build an application which will implement following functionalities
It will displays the filenames in my google drive account
Each file has a Delete File button that can delete the file from my google drive account
Page has a Add File button that lets me upload a new file to my google drive account
Each file has a View File button. If the file is a PDF, display the PDF file in the browser using any open js library of your choice. If the file is not a PDF, download the file to the computer.
Please suggest code or any link or api.
It's all possible with Google Drive REST API. It is well documented and there is a lot of guides and wide variety of languages you can use.
I think the most appreciate for you will be JavaScript. Link to JS quickstart

how to embed a live excel spreadsheet in html

hi i would like to know how i can embed a excel spreadsheet in a web page and change the excel numbers on the hosted file and this in turn automatically changes the webpage sheet?
would like to know if there is a jquery, javascript, css etc code to help me out
for example, book1.xls will be uploaded to the server and index.html will reflect book1.xls as a table in it. when i update book1.xls, it should automatically show in index.html the changed cells.
thanks in advance
The simple way to actually connect to an XLS is through VBScript, but your server will have to support it (which most do).
Another way would be add an ODBC to your servers connectors pointing to your XLS or MDB or whatever Microsoft data file you choose and use JavaScript or any number of languages to connect to it, retrieve data, make changes, etc. The downside is that you must have Administrative rights to the computer hosting the file. You can use a homecomputer to use as server for that file only for instance and link it to your website, but it will affect loading speeds. This will however require you to take a closer look at your home internet security...!!!...but will enable you to make 'live' changes without going to your website. This method is often used for webshops and online catalogues, places where data can change on a daily basis but a database server is undesirable.
The simplest and easiest way is as mentioned before the use of GoogleDocs, but that will require conversion of the document. You won't be using your XLS as datafile. The downside here is that if you make any changes offline (not through the website) the changes will also not be visible, because you'll be editing a completely different file. So you'll need to convert and upload it to GoogleDocs each and every time.
As you can see the method used greatly depends on how often you plan on updating the data, how much traffic you expect and how secure you want it to be.
A "live" spreadsheet can be shown in a web page via an iframe containing a Google Doc spreadsheet. You cut 'n paste the iframe markup from Google Docs and drop it into your web page. The spreadsheet is editable in GDocs. The iframe view can be set to automatically update when the ss is edited.
Perhaps, this is too bland a solution. But it works. I use it all the time.
I doubt you can do that directly from an .xls file, but if you save your Excel file as .csv, you can read a .csv file via jQuery.
There's a plugin here that displays data from a csv file as a table: http://plugins.jquery.com/project/csv2table
The same/similar question is also asked in these posts:
Read Excel data with JQuery
How to parse an excel file in JavaScript?

Categories