Google Spreadsheet Script to publish chart - google-apps-script

Is there a way to publish a chart with a Google spreadsheet script? I dynamically create charts, but need a way to also dynamically publish these charts.
I am referring to the process of publishing a chart from the hidden menu at the top right of a chart. See below.

Unfortunately this functionality doesn't exist in Apps Script, but you can file a feature request on our issue tracker.

If the dynamic reports are replacing your charts like it did for me I just created a named range on the sheet that held the dynamic data. Then used =importRange to populate the sheet with the chart, then you publish the one time, my data pulls every hour, so my chart updates every hour. Hope it helps.

Related

Script to "click" on a drawn button on a Google Sheet for Analytics v4 Report?

I have a Google Sheets Apps Script question related to an extension I use. We use Google Analytics v4 for data on our app's activity, and I pull daily numbers on that into a Google Sheet to create reports. Google made a free extension to do that for GA v3, but not for v4, and so I have to use an extension called Google Analytics Connector by SyncWith in order to get the data. It gives you 35 free report refreshes per month before it locks down and makes you pay to get any more, so I have to be very specific about only refreshing once a day (my company is not going to pay for a monthly plan from them). SyncWith has an automatic daily refresh setting, but the problem is it doesn't let you pick the specific time that it refreshes.
SyncWith makes spreadsheets for its reports, and originally had a TRUE/FALSE checkbox at the top. When you checked it, it would execute their code to pull in the new day's numbers from GA v4. I made this simple Apps Script that would simply check the box and uncheck it to get the report to run, and had a trigger set to run the Apps Script between 6 and 7 a.m.
function AppDataRefresh() {
var sheet = SpreadsheetApp.getActive().getSheetByName('App Daily data');
sheet.getRange('A1').setValue("TRUE");
sheet.getRange('A1').setValue("FALSE");
}
However, now SyncWith has replaced its checkboxes with a new panel at the top that uses drawn buttons. This is what it looks like: https://freeimage.host/i/H7FfrEF
So, unfortunately, there's no longer any checkbox, meaning I can't get this report generated automatically at a specific time with my original Apps Script fix. So, my question is, based on the above picture, is there any kind of an Apps Script that can simulate clicking on a drawn button in a Google Sheet, based on cell location? For example, is there an Apps Script that could click "Refresh" by just clicking on cell D1?

Google Sheets Update Filter data range when new rows aded

I have a Google Sheets spreadsheet with several tabs. Data is written to the 'tracker' tab constantly by a script which is writing information from incoming files. So new rows are constantly being added.
The tracker tab has a number of 'filter views' built using the UI. The data range that these filter views point to does not update when new rows are added.
I have seen some scripts which seem to be able to update the range if usng the Google Sheets API. However, I need something that runs within Google Apps Script itself..
Can anyone help?
The answer was to add the Google Sheets API via the add Services menu.

Is there a way to convert/export a Google Sheets Chart into Google Apps Script?

Simply, I have created a chart by inserting a chart and adding range/settings etc.
But I have realised that when resizing the chart (by recording a macro) all the settings are lost.
Is there a way to convert the Google Sheets Chart into Google Apps Script, otherwise I think I will have to re-create the graph in Google Apps Script. Just hoping to save some time with this query.
Thank you in advance.
I understood that you want to create a graph in Apps Script in a similar way that you did in a Sheet. If I understood it right, then you can complete your aim by using Charts Service. You can see a full example in the linked documentation.
Just to clarify it, first you would need to create a table using DataTableBuilder. This table should be equal to the one in your Sheet. After that you can create a graph based on that table. Please, ask me any question if you still have doubts.

How to create a dynamic chart in google site with data from google spreadsheet?

I come from Vietnam so my English not quite! Please people sympathize if I have written anything confusing!
I want to create a line chart in google site with data taken from google spreadsheet. If the data in the spreadsheet update then chart in the site automatically changes (like chart that when we insert in the spreadsheet).
The spreadsheet is response from the form : http://goo.gl/forms/jRjl0DCAf3
Thank you very much!
Taken verbatim from here in Google Sites help. I have italicized the most important information for automatically updating the chart.
To insert a chart into a site, follow these steps:
Open the site page you'd like to insert a chart into.
Click the edit page button.
Go to the Insert menu, and select Chart.
Select a spreadsheet from the list that contains the chart data you'd like to display.
- If the spreadsheet already contains a chart, you can select the chart. This will be a snapshot of the spreadsheet chart, and the chart won't update if spreadsheet data is modified. To insert a chart that dynamically updates, open the charts editor and select the Live option.
- If the spreadsheet doesn't already have a chart in it, enter a range of data. If you mark Live, the chart will update as spreadsheet data is modified. If you mark Snapshot, the chart won't update unless you manually do so. Learn more about creating a chart.
Once you've selected or created a chart, click OK.
On the next page, you can adjust the dimensions of the chart and change the title. When you've done so, click Save, and the chart will be inserted into the page.
Keep in mind:
Anyone viewing your site can view a Snapshot chart. If you've selected Live updating for your chart, only people who have access to the spreadsheet will be able to view an updated version of the original chart.

How to reference an existing chart in a google spreadsheet

I want to make changes to existing google charts in my spreadsheet when new data is entered. I have and onEdit function that is working nicely but I cannot figure out how to get a "pointer" to the existing chart objects in the spreadsheet.
See Programmatically Managing Charts in Spreadsheets:
Also, Other Google I/O announcements may be of interest
I hate to have to break the bad news. But it is just not possible. There's no API at all to deal with charts in spreadsheets.
If it's not a problem in your use-case. You could generate the chart image/url automatically from the script using the Google Charts Tools and then insert the it on the spreadsheet.