Class DataSourceRefreshScheduleFrequency
Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Programaçãode atualizaçãodafontede dados
Acessar a frequência de uma programação de atualização, que especifica com que frequência e quando atualizar.
Use essa classe apenas com dados conectados a um banco de dados.
Para saber a próxima vez que essa programação de atualização vai ser executada, use DataSourceRefreshSchedule.getTimeIntervalOfNextRun()
.
Para atualizar, use DataSourceRefreshSchedule.setFrequency(newFrequency)
.
Documentação detalhada
getDaysOfTheMonth()
Recebe os dias do mês como números (1 a 28) para atualizar a fonte de dados. Só é aplicável
se o tipo de frequência for mensal.
Retornar
Integer[]
: os dias do mês em que a atualização será feita.
Autorização
Os scripts que usam esse método exigem autorização com um ou mais dos seguintes escopos:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getDaysOfTheWeek()
Recebe os dias da semana em que a fonte de dados será atualizada. Só se aplica se o tipo de frequência
for semanal.
Retornar
Weekday[]
: os dias da semana em que a atualização será feita.
Autorização
Os scripts que usam esse método exigem autorização com um ou mais dos seguintes escopos:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getFrequencyType()
Recebe o tipo de frequência.
Retornar
FrequencyType
: o tipo de frequência.
Autorização
Os scripts que usam esse método exigem autorização com um ou mais dos seguintes escopos:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
getStartHour()
Recebe a hora de início (como um número de 0 a 23) do intervalo de tempo em que a programação de atualização
é executada. Por exemplo, se a hora de início for 13 e a duração do intervalo for 4 horas, a fonte de dados será atualizada entre 13h e 17h. A hora é no fuso horário da
planilha.
Retornar
Integer
: a hora de início.
Autorização
Os scripts que usam esse método exigem autorização com um ou mais dos seguintes escopos:
-
https://www.googleapis.com/auth/spreadsheets.currentonly
-
https://www.googleapis.com/auth/spreadsheets
Exceto em caso de indicação contrária, o conteúdo desta página é licenciado de acordo com a Licença de atribuição 4.0 do Creative Commons, e as amostras de código são licenciadas de acordo com a Licença Apache 2.0. Para mais detalhes, consulte as políticas do site do Google Developers. Java é uma marca registrada da Oracle e/ou afiliadas.
Última atualização 2025-07-26 UTC.
[null,null,["Última atualização 2025-07-26 UTC."],[[["\u003cp\u003e\u003ccode\u003eDataSourceRefreshScheduleFrequency\u003c/code\u003e allows you to access and manage the frequency of data source refreshes for spreadsheet data connected to a database.\u003c/p\u003e\n"],["\u003cp\u003eYou can retrieve information about the refresh schedule, including the days of the month or week, the frequency type, and the start hour of the refresh.\u003c/p\u003e\n"],["\u003cp\u003eUse \u003ccode\u003eDataSourceRefreshSchedule.getTimeIntervalOfNextRun()\u003c/code\u003e to determine the next scheduled refresh time.\u003c/p\u003e\n"],["\u003cp\u003eUpdate the refresh frequency using \u003ccode\u003eDataSourceRefreshSchedule.setFrequency(newFrequency)\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eScripts using these methods require authorization with specific scopes related to spreadsheet access.\u003c/p\u003e\n"]]],["This content describes the `DataSourceRefreshScheduleFrequency` class for managing data refresh schedules connected to databases. Key actions include accessing the refresh frequency, determining the next run time via `getTimeIntervalOfNextRun()`, and updating the schedule with `setFrequency()`. Information can be retrieved for monthly refreshes, with `getDaysOfTheMonth()`, or for weekly refreshes, with `getDaysOfTheWeek()`. `getFrequencyType()` retrieves the type, and `getStartHour()` the start time. The relevant authorization scopes are also specified.\n"],null,["# Class DataSourceRefreshScheduleFrequency\n\nDataSourceRefreshScheduleFrequency\n\nAccess a refresh schedule's frequency, which specifies how often and when to refresh.\n\n\n**Only use this class with data that's connected to a database.**\n\n\nTo see the next time this refresh schedule is scheduled to run, use [DataSourceRefreshSchedule.getTimeIntervalOfNextRun()](/apps-script/reference/spreadsheet/data-source-refresh-schedule#getTimeIntervalOfNextRun()).\n\nTo update, use `Data``Source``Refresh``Schedule.setFrequency(newFrequency)`. \n\n### Methods\n\n| Method | Return type | Brief description |\n|---------------------------------------------|--------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------|\n| [getDaysOfTheMonth()](#getDaysOfTheMonth()) | `Integer[]` | Gets the days of the month as numbers (1-28) on which to refresh the data source. |\n| [getDaysOfTheWeek()](#getDaysOfTheWeek()) | [Weekday[]](../base/weekday.html) | Gets the days of the week on which to refresh the data source. |\n| [getFrequencyType()](#getFrequencyType()) | [FrequencyType](/apps-script/reference/spreadsheet/frequency-type) | Gets the frequency type. |\n| [getStartHour()](#getStartHour()) | `Integer` | Gets the start hour (as a number 0-23) of the time interval during which the refresh schedule runs. |\n\nDetailed documentation\n----------------------\n\n### `get``Days``Of``The``Month()`\n\nGets the days of the month as numbers (1-28) on which to refresh the data source. Only applies\nif frequency type is monthly.\n\n#### Return\n\n\n`Integer[]` --- The days of the month on which to refresh.\n\n#### Authorization\n\nScripts that use this method require authorization with one or more of the following [scopes](/apps-script/concepts/scopes#setting_explicit_scopes):\n\n- `https://www.googleapis.com/auth/spreadsheets.currentonly`\n- `https://www.googleapis.com/auth/spreadsheets`\n\n*** ** * ** ***\n\n### `get``Days``Of``The``Week()`\n\nGets the days of the week on which to refresh the data source. Only applies if the frequency\ntype is weekly.\n\n#### Return\n\n\n[Weekday[]](../base/weekday.html) --- The days of the week on which to refresh.\n\n#### Authorization\n\nScripts that use this method require authorization with one or more of the following [scopes](/apps-script/concepts/scopes#setting_explicit_scopes):\n\n- `https://www.googleapis.com/auth/spreadsheets.currentonly`\n- `https://www.googleapis.com/auth/spreadsheets`\n\n*** ** * ** ***\n\n### `get``Frequency``Type()`\n\nGets the frequency type.\n\n#### Return\n\n\n[FrequencyType](/apps-script/reference/spreadsheet/frequency-type) --- The frequency type.\n\n#### Authorization\n\nScripts that use this method require authorization with one or more of the following [scopes](/apps-script/concepts/scopes#setting_explicit_scopes):\n\n- `https://www.googleapis.com/auth/spreadsheets.currentonly`\n- `https://www.googleapis.com/auth/spreadsheets`\n\n*** ** * ** ***\n\n### `get``Start``Hour()`\n\nGets the start hour (as a number 0-23) of the time interval during which the refresh schedule\nruns. For example, if the start hour is 13 and the time interval's duration is 4 hours, then\nthe data source is refreshed between 1 p.m. and 5 p.m. The hour is in the timezone of the\nspreadsheet.\n\n#### Return\n\n\n`Integer` --- The start hour.\n\n#### Authorization\n\nScripts that use this method require authorization with one or more of the following [scopes](/apps-script/concepts/scopes#setting_explicit_scopes):\n\n- `https://www.googleapis.com/auth/spreadsheets.currentonly`\n- `https://www.googleapis.com/auth/spreadsheets`"]]