Discover, analyze, get recomendations and fix Basic Technical SEO Issues now with 25+ tools and reports from the SEO Book Pro Beta Technical SEO and Website Audit Dashboard.
View All Dashboard Beta ToolsSEO Book Pro Nightly Alpha Documentation
Documentation
View the Full DocumentationSEO Book Pro - Server Database Status
FREE Basic SEO Audit
Basic Free Site Audit and Analyze Website for Technical and SEO Errors
Recent Posts ( 123 )
Dashboard Documentation ( 36 files )
- Introduction
- Audit Dashboard
- Main Dashboard
- Structured Data
- Your website on Google
- How Google Works
- SEO starter guide
- Guidelines
- Do you need an SEO?
- Maintaining your site
- Developer's guide
- Sitemaps
- robots.txt
- Meta tags
- Crawler management
- Removals
- Canonical URLs
- Site moves
- Redirects
- JavaScript SEO
- Multilingual sites
- Title links
- Snippets
- Images
- Videos
- Structured data
- Business details
- Favicons
- Publication dates
- Search Appearance
- Page experience
- Navigation structures
- Pagination loading
- HTTPS
- Mobile-friendliness
- Interstitials and dialogs
- View all SEO Topics
Latest Brand and Domains Audits ( 44 )
Technical SEO And Websites Audit ( 3 Guides)
SEO Book Pro Beta v/h
Technical SEO And Websites Audit Dashboard
SEO Book Pro is a suite of SEO tools that helps website owners and digital marketers optimize their websites for search engines. The tool provides features like keyword research, on-page optimization, link analysis, and site ranking reports, among others. SEO Book Pro is aimed at both experienced SEO professionals as well as beginners who are just starting out with search engine optimization.
Latest is_archivesGoogle App Script add a timestamp in speccific cell whenever a cell in column X of the “SheetName” is edited
How to add a timestamp in specific cell whenever a cell in column “Column A” of the “Sheet Name” is edited
The onEdit function you provided is designed to add a timestamp in the adjacent cell whenever a cell in column A or E of the “SheetName” sheet is edited.To add a record to the same cell every time the sheet is edited, you could modify the function like this:
function onEdit() {
var sheet = SpreadsheetApp.getActiveSheet();
var cell = sheet.getRange("A1"); // change this to the cell where you want to add the record
if (sheet.getName() == "SheetName" && sheet.getActiveCell().getColumn() == 0) {
// if we're on the right sheet and editing column A
cell.setValue(cell.getValue() + "New Record Added on " + new Date());
}
}
In this version of the function, we’re setting the cell variable to the range of the cell where you want to add the record (currently set to cell A1, but you can change this to any other cell). Then, we’re checking if we’re on the “RESTAPI” sheet and editing column A. If those conditions are met, we’re appending a new record to the cell’s existing value, along with the current date and time. Note that this will overwrite the existing value in the cell every time the sheet is edited. If you want to add a new record to the cell without overwriting the existing value, you’ll need to modify the code to retrieve the current value of the cell and concatenate the new record to it.
How to add record on same cells for every row in the table
If you want to add a record to the same cell for every row in the table, you can modify the onEdit function like this:function onEdit() {
var sheet = SpreadsheetApp.getActiveSheet();
var startRow = 2; // adjust this to the first row of the table
var endRow = sheet.getLastRow(); // gets the last row of the sheet
var cell = sheet.getRange("A2"); // change this to the cell where you want to add the record
if (sheet.getName() == "SheetName" && sheet.getActiveCell().getColumn() == 0) {
// if we're on the right sheet and editing column A
for (var i = startRow; i <= endRow; i++) {
var rowRange = sheet.getRange(i, 1, 1, 5); // adjust the range to cover all columns in the table
var rowValues = rowRange.getValues()[0];
cell.offset(i - startRow, 0).setValue(rowValues.join(", ") + "New Record Added on " + new Date());
}
}
}
In this version of the function, we’re first setting the startRow variable to the first row of the table (assuming the table starts on row 2), and the endRow variable to the last row of the sheet. Then, we’re setting the cell variable to the range of the cell where you want to add the record (currently set to cell A2, but you can change this to any other cell). Next, we’re checking if we’re on the “SheetName” sheet and editing column A. If those conditions are met, we’re looping through all the rows in the table using a for loop, and for each row, we’re getting the values of all the columns using getValues, joining them together into a string using join, and then appending a new record to that string along with the current date and time. Finally, we’re using offset to set the value of the appropriate cell in the same row as the current row in the loop. Note that we’re subtracting startRow from i to get the correct offset, since offset uses a zero-based index.
This article was written by SEO Book Pro
Published on 12:33 pm, Wed, 15 February 23
Published on 12:33 pm, Wed, 15 February 23