google-sheets-macros

How to automatically switch from view mode to edit mode and vice-versa

痞子三分冷 提交于 2020-06-17 09:32:09
问题 I have several sheets as subjects in my Google Spreadsheet where attendance are recorded from an android app. When I select View mode to Edit mode, attendance can be recorded. By default I want to keep it in view mode so that students can NOT submit attendance outside the time given by me as a owner of the sheets or the class teachers (editors). Please note that my sheet users are: me as a owner and also editor course teachers as a editors (several sheets means several subjects are there) the

How to delete all unprotected rows in a range of particular sheets from Google Sheets using Apps Scripts

╄→尐↘猪︶ㄣ 提交于 2020-06-16 17:25:14
问题 I have several protected range in a sheet of my Google Sheets for example, A2 to F40 and then A45 to F90. I do this protected range using a button (menu--submenu). But there are few rows of data unprotected throughout a range of particular sheets having names using alphabets and numbers together (e.g. ICT4113, MATH4104 or HUM4119). There are few other sheets having names containing only alphabets which does not require this function. How can I delete those unprotected rows of data throughout

How to set a value in the cells of the next column?

妖精的绣舞 提交于 2020-05-17 05:27:50
问题 I have table with hundred of text entries. I want to tag those entries according to the original text. Eg: TEXT (A) TAG (B) Facebook Social Media Instagram Social Media Stackoverflow Good Site I am using the code below. But this only copies the column A into column B !! var sheet = SpreadsheetApp.getActiveSheet(); var range = sheet.getRange('A2:A5'); var data = range.getValues(); var tag = sheet.getRange('B2:B5'); for (var i = 0; i<data.length; i++) { if(String(data[i][1]).match(/facebook

How to set a value in the cells of the next column?

筅森魡賤 提交于 2020-05-17 05:26:06
问题 I have table with hundred of text entries. I want to tag those entries according to the original text. Eg: TEXT (A) TAG (B) Facebook Social Media Instagram Social Media Stackoverflow Good Site I am using the code below. But this only copies the column A into column B !! var sheet = SpreadsheetApp.getActiveSheet(); var range = sheet.getRange('A2:A5'); var data = range.getValues(); var tag = sheet.getRange('B2:B5'); for (var i = 0; i<data.length; i++) { if(String(data[i][1]).match(/facebook

How to set a value in the cells of the next column?

人盡茶涼 提交于 2020-05-17 05:25:58
问题 I have table with hundred of text entries. I want to tag those entries according to the original text. Eg: TEXT (A) TAG (B) Facebook Social Media Instagram Social Media Stackoverflow Good Site I am using the code below. But this only copies the column A into column B !! var sheet = SpreadsheetApp.getActiveSheet(); var range = sheet.getRange('A2:A5'); var data = range.getValues(); var tag = sheet.getRange('B2:B5'); for (var i = 0; i<data.length; i++) { if(String(data[i][1]).match(/facebook

Creating a function that returns a date in Google Sheets

独自空忆成欢 提交于 2020-05-09 06:24:05
问题 I created a function that takes in a date and number of months to add to that date and returns the next date. The function seems to be working perfectly, which I check using DEBUG. The strange thing is when I logger in the returned date using the line below, monthstoadd = 18 date1.setFullYear(2019, 6, 1); returnDate = AddMonths(date1, monthstoadd); // my selfmade function Logger.log("returnDate(1):", returnDate.getMonth(), "/" , returnDate.getDay(), "/", returnDate.getFullYear()); the date in

How to set values in new column with validation from a Named Range?

霸气de小男生 提交于 2020-04-30 08:47:38
问题 Following a previous question I want to classify text entries by adding a tag in the next column. I could do it using regex but it will take too much time writing all conditions like : if(String(data[i][0]).match(/acme|brooshire|dillons|target|heb|costco/gi)) { labValues[i][0]='Supermarket'; } Instead I created a named list with all stores names (in another sheet). If an entry matches a term in the list, the next column is set to " Supermarket ". I am using this script below... No bugs but

How to set values in new column with validation from a Named Range?

我们两清 提交于 2020-04-30 08:46:47
问题 Following a previous question I want to classify text entries by adding a tag in the next column. I could do it using regex but it will take too much time writing all conditions like : if(String(data[i][0]).match(/acme|brooshire|dillons|target|heb|costco/gi)) { labValues[i][0]='Supermarket'; } Instead I created a named list with all stores names (in another sheet). If an entry matches a term in the list, the next column is set to " Supermarket ". I am using this script below... No bugs but