--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/3a7884f1-5a9f-4cb7-99f8-83b1703c575ao%40googlegroups.com.
Need a little more explanation... Your code on StackOverflow looks like you are trying to add data to the last row on a spreadsheet, just like when a Google Form is submitted. However, you say "not all columns are of equal length"... My question is, why?If you are trying to use the spreadsheet as a "database" then you should be appending rows. Your "addRecord" function looks to be trying to emulate how a Google Form appends data. If you are missing data for a column, no big deal. You will just have to handle that when you try to read the values.
On Mon, Jun 15, 2020 at 3:35 PM Dan Konig <dan....@connection.com> wrote:
--Adding a value to a the last row of a spreadsheet but adding a value to the end of a specific column seems to be elusive to me. How would you do this?I posted this over in StackOverflow as well. You can see a lot more detail there. I'd be happy to post it here as well if necessary.
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-community+unsub...@googlegroups.com.
function addProduct() {
let newProd = document.getElementById("newProduct").value;
google.script.run.withSuccessHandler(updateProductDropdown).addNewProduct(newProd);
document.getElementById("newProduct").value = "";
}
function updateProductDropdown(newProd){
var newOption = document.createElement("option");
newOption.innerText = newProd;
document.getElementById("product").append(newOption);
}
function addNewProduct(newProd){
var columnLetterToGet, columnNumberToGet, direction, lastRow, lastRowInThisColWithData, rng, rowToSet, startOfSearch, valuesToSet;
var ss = SpreadsheetApp.openById(ssId);
var ws = ss.getSheetByName("List Source");
lastRow = ws.getLastRow();
columnNumberToGet = 2;
columnLetterToGet = "B";
startOfSearch = columnLetterToGet + (lastRow).toString();
rng = ws.getRange(startOfSearch);
direction = rng.getNextDataCell(SpreadsheetApp.Direction.UP);
lastRowInThisColWithData = direction.getRow();
rowToSet = lastRowInThisColWithData + 1;
valuesToSet = [newProd];
ws.getRange(rowToSet, 9).setValues([valuesToSet]);
}
<select id="product" onchange="buildURL()">
<option disabled selected value="">Choose a product</option>
<?!= productList; ?>
</select>
On Tuesday, June 16, 2020 at 8:39:16 AM UTC-4, Dan Konig wrote:
@mro.michael The code I posted was how I am adding a record to a sheet. That is indeed being used as a database. What I am now trying to do is add a value to the end of a column on another sheet which serves as the data source for my various dropdowns. Not all dropdowns have the same number of values hence the reason they don't have the same number of rows.Make sense? Maybe sharing the code I am using to add a record is not the best choice but I envisioned the add to column being similar in some ways.
On Monday, June 15, 2020 at 9:28:47 PM UTC-4, mro.michael wrote:
Need a little more explanation... Your code on StackOverflow looks like you are trying to add data to the last row on a spreadsheet, just like when a Google Form is submitted. However, you say "not all columns are of equal length"... My question is, why?If you are trying to use the spreadsheet as a "database" then you should be appending rows. Your "addRecord" function looks to be trying to emulate how a Google Form appends data. If you are missing data for a column, no big deal. You will just have to handle that when you try to read the values.
On Mon, Jun 15, 2020 at 3:35 PM Dan Konig <dan....@connection.com> wrote:
--Adding a value to a the last row of a spreadsheet but adding a value to the end of a specific column seems to be elusive to me. How would you do this?I posted this over in StackOverflow as well. You can see a lot more detail there. I'd be happy to post it here as well if necessary.
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/3a7884f1-5a9f-4cb7-99f8-83b1703c575ao%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/cc8776fe-e23c-46b8-be68-a7a3f43babf7o%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-community+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/3a7884f1-5a9f-4cb7-99f8-83b1703c575ao%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-community+unsub...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/3a7884f1-5a9f-4cb7-99f8-83b1703c575ao%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/cc8776fe-e23c-46b8-be68-a7a3f43babf7o%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/2a411553-9bf2-4be0-9496-4da1b6a0d221o%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-community+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/3a7884f1-5a9f-4cb7-99f8-83b1703c575ao%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-community+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/cc8776fe-e23c-46b8-be68-a7a3f43babf7o%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-community+unsub...@googlegroups.com.
function updateProductDropdown(newProd){
alert(newProd);
}
function updateProductDropdown(newProd){
newProdOption = document.getElementById('product');
newProdOption.innerHTML += '<option>' + newProd + '</option>';
alert(newProdOption.innerHTML)
}
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/3a7884f1-5a9f-4cb7-99f8-83b1703c575ao%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/cc8776fe-e23c-46b8-be68-a7a3f43babf7o%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/2a411553-9bf2-4be0-9496-4da1b6a0d221o%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/dcf0fa8b-44ae-4a3e-98bb-4e17231c32a5o%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-community+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/3a7884f1-5a9f-4cb7-99f8-83b1703c575ao%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-community+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/cc8776fe-e23c-46b8-be68-a7a3f43babf7o%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-community+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/2a411553-9bf2-4be0-9496-4da1b6a0d221o%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-community+unsub...@googlegroups.com.