Embed google sheets w/o updating source - javascript

I have a published Google sheet and I would like to use it in a website.
What I want is to have something such a "local copy" of that sheet, that is when I update sheet on my website the update remain local.
I will use this sheet for an order form, so every user of my website should have a empty version of sheet.
Is there any way to do this?

Just a a proposal & I hope it works in your case.
Separate the file into Master sheet (Sheet1) & Input Sheet (Sheet2)
File A contains Sheet1&2
File B contains Sheet2 only
Share only file B on the website.
But (when the time comes to sync the info) copy File B Sheet2 content to File A Sheet2. And all the formula inside it (Master sheet) should work just fine.

Related

How to print Google Drive folder name in the cell automatically by pasting the folder ID on adjacent cell

How to print Google Drive folder name in the cell automatically by pasting the folder ID on adjacent cell in google app script on Google Sheets.
Suppose I have two cells A1 and B1, is it possible to get fetch or get the Google drive's folder name automatically on cell B1 when we paste the folder ID in cell A1? I wonder there might be a Google app script function which could make this possible. Please help me out in this case. I'd be glad if you could share the script.
I've crawled internet and didn't found any solution please help me out in this.
IMAGE ELABORATION:
function myFunction() {
const ss = SpreadsheetApp.getActive();
const sh = ss.getSheetByName('Sheet1');
var folder_id = ss.getRange("Sheet1!B2").getValue(); // get value in "Settings!C9"
const destinationFolder = DriveApp.getFolderById(folder_id);
sh.getRange('E2').setValue(destinationFolder);
}
As mentioned in the comment, you will need to use a trigger to do this process. For this case, you will need to add a trigger manually
Since the simple triggers do not work when they call Google Services. In this case the DriveApp services. This information can be found in this Google Documentation.
They cannot access services that require authorization. For example, a simple trigger cannot send an email because the Gmail service requires authorization, but a simple trigger can translate a phrase with the Language service, which is anonymous.

How to create Google Sheets Macro/Apps Script to Open Newly Added File and Copy Data to Master?

I would like to create an automatic process with Apps Script to trigger on newly added excel files in Google Drive, open them, and copy the new data and append it to last row in the Master Google sheet.
The data would also need to be manipulated a bit as it comes in the format below. There will be several blocks like this for every vehicle. I would like the script to populate the vehicle # in each of the rows of available data for that vehicle in a separate column, in this case 6 rows. Then copy the data between rows labeled VEHICLE and VEHICLE TOTALS and paste it into the last row of the Master google sheet.
Data Table Example:
This looks to have a lot of working parts, so it'd be hard to cover in one response. But here's how I'd go about it...
Create a trigger
Scan the folder to find docx file
Convert docx file to Google Doc
Pull data from doc file to sheet
Manipulate data accordingly Write to appropriate location
Create a trigger - This might be the hardest part. I don't think dropping it into a directory can trigger a script. Instead, you can have your scripts timed, trigger them manually, or trigger based on an event within another G Suite document (sheet, docs, forms, etc.) Maybe you can just create a Google Form that you upload the file to?
Scan the folder to find docx file - Once it's somewhere in your GDrive and you've trigger a script, you can find it using the Folder and Folder Iterator classes
Convert docx file to Google Doc - Looks pretty straightforward Docx to Google Doc using Google Script
Pull data from doc file to sheet - A combination of the Document class, Spreadsheet class, and Google Script programming know-how.
Manipulate data accordingly & Write to appropriate location - Same as above.

Opening and visualizing a spreadsheet

Is there any method to open and visualize with javascript a google spreadsheet?
In other words I would like to create a script in the Google spreadsheet A,which would be able to physically open and select the spreadsheet B. By Looking at Google Script API - I saw that it is possible to use the SpreadsheetApp.openbyID() method;but it doesn't physically open the spreadsheet and select a specific sheet.
Can somebody tell me if this is possible and what API command should be used for the purpose?
You can do it by embed JavaScript to the google spreadshoot page.
For that, you can user userscripts or to developer your an extension for google chrome.
This is one way, from How to access data on different Google Spreadsheet through Google Apps Script?:
var ss = SpreadsheetApp.openById(SPREADSHEET_ID_GOES_HERE);
var sheets = ss.getSheets();
// the variable sheets is an array of Sheet objects
var sheet1A1 = sheets[0].getRange('A1').getValue();
var sheet2A1 = sheets[1].getRange('A1').getValue();
you can open by sheet name, but using the sheet number is faster because it does not require a network call.

Google spreadsheet with hyperlinks via JSON

I'm using json-in-script to put content from a Google Spreadsheet on a web page. The spreadsheet has hyperlinks on some of the text in the cells. JSON doesn't seem to be getting anything other than the plain text of the spreadsheet, and no markup like hyperlinks. How do you get hyperlinks? Can you with JSON?
This is the src of what I'm importing:
http://spreadsheets.google.com/feeds/cells/0Aipg92XowKCndHhtbnZXQkllWEUzUjBEc3NkQXppdnc/1/public/values?alt=json-in-script&callback=cellEntries&min-row=2&min-col=1&max-col=7
This is the link to the spreadsheet (see how the items in col1 are linked?)
https://spreadsheets.google.com/spreadsheet/pub?hl=en_US&hl=en_US&key=0Aipg92XowKCndHhtbnZXQkllWEUzUjBEc3NkQXppdnc&output=html
Can anyone advise me how to get the hyperlinks?
Thanks!
You'll want to do some post-processing, checking if a value matches a URL. If it does, create your own tag for it.
Use one of these:
http://www.google.com/search?q=url+regex
Also, you know that you can embed Google Spreadsheets directly in a webpage? I'm guessing you're not doing this because it would use an iFrame, and what you want is the actual data?
Rather than using the Google Speadsheets API (which is quite cumbersome), you should use jsondata.com. It'll let you upload all the data from a .csv and embed it in your site with YouTube-style embed code.
The post processing is a piece of cake when you get your entire dataset to your application in a nicely formatted JSON object.

Excel Spreadsheet to HTML Chart dynamically

I have an excel spreadsheet that is going to be updated monthly and then displayed on a Blackberry browser. I've already created a website that has all the spreadsheet information in their statically and uses HTML definition lists and CSS to create charts.
I'm looking for a way to load a new spreadsheet into the server each month and have the website update accordingly. I've started creating JavaScript variables in the HTML page so they can be changed whenever a new dataset is received. However, I'm struggling with how to set the data to the variables without manual entry. Any suggestions?
There are javascript codes to read CSV files.
Just search for: javascript CSV
Take CSV2TABLE as an example:
http://plugins.jquery.com/project/csv2table

Categories

Resources