T
T
Teslaboy12021-07-18 09:36:36
Google Sheets
Teslaboy1, 2021-07-18 09:36:36

Why does the script use all cells A1 in the table for its calculations?

In the table on all tabs, cell A1 began to pull up some values. It is simply converted to a number and cell changes are not saved. As if the import was pulled up.
The value constantly changes if you change other cells.

Could this be due to adding a script to the table (counting values ​​based on color)? The script has a parameter for cell A1 - and, as I understand it, it is responsible for a certain buffer in the script. But why did it occupy all cells A1 in the table, and not just the desired tab? How to fix this, maybe the script is needed.

60f3cb9523abe664340924.png
60f3cb9f1837d837618759.png
60f3cdac343e6135751462.png
60f3cfb86e197115412301.png
60f3cfc19576d269257430.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Ivanov, 2021-07-19
@Teslaboy1

You probably need to check the sheet name before processing it

/**
 *
 * @param {GoogleAppsScript.Events.SheetsOnEdit} e
 */
function onEdit(e) {
  const sheetName = 'Sheet6'; // Имя листа, который можно использовать

  if (e && e.range) {
    const sheet = e.range.getSheet();
    if (sheet.getName() === sheetName) 
    sheet.getRange('A1').setValue(Math.random());
  }
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question