Генерируем красивую google-таблицу из своей программы (используя google sheets api v4)
Содержание:
Partial responses
Spreadsheets are big, and often you don’t need every part of the spreadsheet.
You can limit what’s returned in a Google Sheets API response, using the
URL parameter. This is especially useful in the
spreadsheets.get
method. For best performance, explicitly list only the fields you need in the
reply. The format of the parameter is the same as the .
In a nutshell, multiple different fields are comma separated, and subfields
are dot-separated. For convenience, multiple subfields from the same type can
be listed within parentheses.
For example, to retrieve the spreadsheet’s title, the sheet’s properties, and
the value and format of range A1:C10. you could use the following request:
GET https://sheets.googleapis.com/v4/spreadsheets/spreadsheetId?ranges=A1:C10&fields=properties.title,sheets(properties,data.rowData.values(effectiveValue,effectiveFormat))
Bidding
-
Bid Testing —
Adjusts keyword bids based on a series of multipliers and record the results of
each change. -
Bid to
Impression Share — Finds keywords most in need of adjustment, and raises or
lowers their bids to affect how often they show in search results, for single
accounts or manager
accounts. -
Multi Bidder
— Manages keyword bidding rules, for single accounts or manager
accounts. -
TV Schedule Bid
Coordination — Coordinates the use of bid modifiers on campaign bids with a
pre-defined schedule in a spreadsheet. -
Weather-based
Campaign Management — Fetches weather information and adjust bids
accordingly.
Reports
-
Account
Summary — Generates a report of the performance for a Google Ads
account. -
Ad
Performance — Generates a Google Spreadsheet with distribution charts
showing an ad’s performance. -
BigQuery
Exporter — Exports Google Ads reports to Google BigQuery. -
Declining
Ad Groups — Fetches ad groups with declining performance, for single
accounts or manager
accounts. -
Kratu Report — Shows
performance signals for each account visually as a heat map. -
Mobile
PageSpeed — Provides a report suggesting ways to improve the landing page
experience on mobile, for single accounts or manager
accounts. -
Search Query
— Generates a report showing the actual search queries that trigger your ads,
for either single accounts or manager
accounts.
Специальные методы
Связанные скрипты могут вызывать несколько методов, которые автономные скрипты не могут:
- , и позволяют связанным скриптам ссылаться на их родительский файл, не ссылаясь на идентификатор файла.
- позволяет связанным скриптам получить доступ к пользовательскому интерфейсу для своего родительского файла, чтобы добавить пользовательские меню, диалоги и боковые панели.
- В Google Таблицах , и позволяют сценарию определить текущий лист пользователя, выбранный диапазон ячеек или выбранную отдельную ячейку. и позволяют сценарию изменять эти параметры.
- В Документах Google и позволяют сценарию определять позицию курсора пользователя или выбранного текста. и позволяют сценарию изменять эти местоположения.
Для получения дополнительной информации см. Руководство по расширению Google Таблиц или руководству по расширению Документов Google.
Эти методы доступны только для связанных скриптов, запускаемых из редактора сценариев, элементов меню, диалогов, боковых панелей или триггеров. Когда связанный скрипт запускается как веб-приложение или через API скриптов приложений, эти методы недоступны.
Tools
-
Account
Auditor — Checks that your campaigns, ad groups, ads, and keywords are
structured as intended, for single accounts or manager
accounts. -
Ad Customizer —
Fetches live data and update an ad to reflect current prices, inventory levels,
or anything else that may change over time. -
Automatic
Placement Exclusion — Exclude placement of under-performing video ads. -
Bulk
Shopping Ad Group Creator — Provides a way to bulk create ad groups and
product groups in existing Shopping Campaigns. -
Campaign-level
Audiences Transition Tool — Allows you to simplify your account setup by
scanning your audiences at ad group-level and promoting eligible ones to
campaign-level. -
ETA
Transition Helper — Easily convert your standard text ads to expanded text
ads. -
Flexible
Budgets — Dynamically adjusts campaign budget daily with a custom budget
distribution scheme, for single accounts or manager
accounts. -
Inventory-based
Ad Management — Manages ads based on an inventory database. -
Keyword Labeler —
Selects keywords using flexible rules and labels them for later review. -
Large
Manager Hierarchy Template — Provides a general framework for manager
accounts to run script logic on all of their client accounts, spread across
many script executions if necessary. -
Master
Negative List — Simplifies management of negative criteria for single
accounts or manager
accounts. -
Sale
Countdown — Updates ad parameters hourly for a countdown to a sales
event. -
Sales
Countdown Calendar — Extends Sale Countdown to multiple events by
integrating a calendar using ad customizers. -
Audience
Assistant — Simplifies the management of your Audience Lists.
Доступ к связанным скриптам
Только пользователи, имеющие разрешение на редактирование контейнера, могут запускать свой связанный скрипт. Соавторы, у которых есть только доступ к просмотру, не могут открыть редактор сценариев, хотя, если они делают копию родительского файла, они становятся владельцем копии и смогут видеть и запускать копию сценария.
Все сценарии, связанные с контейнером, используют один и тот же список доступа владельца, зрителя и редактора, определенный для файла контейнера. Владелец контейнера принимает на себя ответственность за новый проект сценария независимо от того, кто его создал.
Common terms
This section explains some of the terms you’ll encounter when reading about the
Sheets API.
Spreadsheet ID
Every API method requires a parameter which is used to identify
which spreadsheet is to be accessed or altered. This ID is the value
between the «/d/» and the «/edit» in the URL of your spreadsheet. For example,
consider the following URL that references a Google Sheets spreadsheet:
https://docs.google.com/spreadsheets/d/spreadsheetId/edit#gid=0
The spreadsheet ID is a string containing letters, numbers, and some special
characters. The following regular expression can be used to extract the
spreadsheet ID from a Google Sheets URL:
/spreadsheets/d/(+)
If you’re familiar with the Drive API, the corresponds to the
ID of the
resource.
Sheet ID
Individual sheets in a spreadsheet have titles (which must be unique) and
IDs. The is used frequently in the Sheets API to specify which sheet
is being read or updated. In the Sheets UI, you can find the of the
open sheet in the spreadsheet URL, as the value of the parameter.
The following shows the structure of the URL and where can be
found:
https://docs.google.com/spreadsheets/d/spreadsheetId/edit#gid=sheetId
The sheet ID is numeric, and the following regular expression can be used to
extract it from a Google Sheets URL:
gid=(+)
You can also fetch the IDs of sheets using the API — see the
sample.
A1 notation
Some API methods require a range in A1 notation. This is a string like
, that refers to a group of cells in the spreadsheet, and is
typically used in formulas. For example, valid ranges are:
- refers to the first two cells in the top two rows of Sheet1.
- refers to all the cells in the first column of Sheet1.
- refers to the all the cells in the first two rows of Sheet1.
- refers to all the cells of the first column of Sheet 1, from row 5 onward.
- refers to the first two cells in the top two rows of the first visible sheet.
- refers to all the cells in Sheet1.
Named ranges are also supported. When a named range conflicts with a sheet’s
name, the named range is preferred.
If the sheet name has spaces or starts with a bracket, surround the sheet name
with single quotes (), e.g . For simplicity, it is safe to
always surround the sheet name with single quotes.
Date/Time serial numbers
Google Sheets, like most other spreadsheet applications, treats
date/time values as decimal values. This lets you perform arithmetic on them in
formulas, so you can increment days or weeks, add or subtract two date/times,
and perform other similar operations.
Google Sheets uses a form of epoch
date
that is commonly used in spreadsheets. The whole number portion of the value
(left of the decimal) counts the days since December 30th 1899. The fractional
portion (right of the decimal) counts the time as a fraction of one day. For
example, January 1st 1900 at noon would be 2.5, 2 because it’s two days after
December 30th, 1899, and .5 because noon is half a day. February 1st 1900 at
3pm would be 33.625.
Note that Google Sheets correctly treats the year 1900 as a common year, not a
leap year.