Тёмный

Multiple Dependent Dropdown Lists on Every Line In Google Sheets with Google Apps Script 

Hash Ali
Подписаться 16 тыс.
Просмотров 1,6 тыс.
50% 1

Опубликовано:

 

3 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 18   
@HashAliNZ
@HashAliNZ 3 месяца назад
Got a request? Ask down here ↓
@Vish_Al_Mighty
@Vish_Al_Mighty 2 месяца назад
Your content is phenomenal. The explanation, visuals, pace, just about everything is brilliant. Subscribed in an instance!
@HashAliNZ
@HashAliNZ 2 месяца назад
Thanks so much, Vish!
@TrườngPhùng-DHOE
@TrườngPhùng-DHOE 2 месяца назад
If I want to change the initial data fill column from Col2 to Col4 then what value should I adjust in the code you shared.
@abdullahquhtani8058
@abdullahquhtani8058 3 месяца назад
Great 👍👍👍
@JOELY713
@JOELY713 Месяц назад
Awesome video! On my 'home' page my drop down starts in column E. How do I modify the code for that difference? I've been trying to figure it but to no avail.
@HashAliNZ
@HashAliNZ Месяц назад
Should be as simple as changing the 2 to a 5 in line 15
@davidmojica5278
@davidmojica5278 3 месяца назад
Hi HashAli, Great video. Can you please share the script so that its easier to copy / paste and edit the values. Thanks!
@HashAliNZ
@HashAliNZ 3 месяца назад
Absolutely. Here you go: script.google.com/d/15RAgd_BcsJM65T6ldiZ7FwCINzuAoCX3kzGWjEFsgs8c46I_SVfJ5XTG/edit?usp=sharing
@davidmojica5278
@davidmojica5278 3 месяца назад
@@HashAliNZ Thank you so much! btw this is the best video I've seen so far on this topic!
@stefania8715
@stefania8715 Месяц назад
Hi, this is great, thank you, but I'm getting two errors: "TypeError: Cannot read properties of undefined (reading 'source')" with the onEdit function and "TypeError: Cannot read properties of undefined (reading 'length')" with the getNextColumnData function. Can you help?
@HashAliNZ
@HashAliNZ Месяц назад
Hi Stefania onEdit functions aren't made to be run using the Run button in Apps Script. When you make a change within the spreadsheet at your target cells then it should work
@stefania8715
@stefania8715 Месяц назад
@@HashAliNZ Thank you for your fast reply! I tried the run button because it didn't already work :( I've changed the sheets names, the edited column number and the data range address , the rest of the code is untouched, can't figure why it doesn't work :((
@HashAliNZ
@HashAliNZ Месяц назад
@stefania8715 feel free to share your code here. I'm not near a computer today so won't be able to get to it til later but could have a read through to see if I can spot any issues
@stefania8715
@stefania8715 Месяц назад
@@HashAliNZ function onEdit(e) { const sheet = e.source.getActiveSheet(); const editedColumn = e.range.columnStart; const editedRow = e.range.rowStart; const dataRangeAddress = 'A2:C'; if (sheet.getName() === 'registrazioni') { const productsSheet = e.source.getSheetByName('dropdownData'); const dataRange = productsSheet.getRange(dataRangeAddress).getValues(); const columnOffset = productsSheet.getRange(dataRangeAddress).getColumn() - 1; const maxColumnIndex = productsSheet.getRange(dataRangeAddress).getLastColumn() - columnOffset; clearDropdowns(sheet, editedRow, editedColumn, maxColumnIndex + 1); if (editedColumn >= 5 && editedColumn < maxColumnIndex + 1) { const selectedValues = sheet.getRange(editedRow, 2, 1, editedColumn - 1).getValues()[0]; const nextColumnData = getNextColumnData(selectedValues, dataRange, editedColumn - 1); if (nextColumnData.length > 0) { const targetCell = e.range.offset(0, 1); var rule = SpreadsheetApp.newDataValidation() .requireValueInList(nextColumnData, true) .build(); targetCell.setDataValidation(rule); } else { e.range.offset(0, 1).clearContent().clearDataValidations(); } } } } function getNextColumnData(selectedValues, dataRange, columnIndex) { let filteredData = dataRange; for (let i = 0; i < selectedValues.length; i++) { filteredData = filteredData.filter(row => row[i] === selectedValues[i]); } const uniqueNextColumnValues = [...new Set(filteredData.map(row => row[columnIndex]))]; return uniqueNextColumnValues; } function clearDropdowns(sheet, row, startColumn, maxColumn) { for (let col = startColumn + 1; col
@stefania8715
@stefania8715 Месяц назад
@@HashAliNZ I don't know how to show the code to you , I tried both pasting the code and sharing the link to the script but YB doesn't show the comments (at least I don't see them)
Далее
This mother's baby is too unreliable.
00:13
Просмотров 6 млн
🎙Пою РЕТРО Песни💃
3:05:57
Просмотров 1,3 млн
PERFECT PITCH FILTER.. (CR7 EDITION) 🙈😅
00:21
Просмотров 3,3 млн
Google Apps Script Tutorial for Beginners
23:54
Просмотров 380 тыс.
Synchronize Google Sheets Checkboxes Using Apps Script
8:16
This mother's baby is too unreliable.
00:13
Просмотров 6 млн