I've been working on a small search tool in Google Sheets as a personal project to improve my skills and knowledge of GS. Munkey has been guiding me over the past few weeks and helping me develop my understanding.
Below are the links to my "Database" and search tool:
Database - https://docs.google.com/spreadsheets/d/1K53LOopwAJuOVPJ5RXgpmEO7L3JPHnW5Fx2qp6_3kqo/edit?usp=sharing
Search tool - https://docs.google.com/spreadsheets/d/1mY13e-75dBYfKgkjV8dFFFEvxC838nGNxPrUdusc0PA/edit?usp=sharing
Below is the Script that transfers data from the Database to the search tool databases for the Vlookup function:
function getOvenDataV4(){
var ui = SpreadsheetApp.getUi();
ui.createMenu('Export Data')
.addItem('Export Oven Data Now', 'getOvenDataV4')
.addToUi();
var settingsSheetName = "oven_settings";
/* DO NOT EDIT BELOW THIS LINE */
var ss = SpreadsheetApp.getActiveSpreadsheet();
var settings = ss.getSheetByName(settingsSheetName);
var targetSheet = settings.getRange("C2").getValue();
var sSheets = settings.getRange("B2:B").getValues();
var sourceSheets = [];
for(var i = 0; i < sSheets.length;i++){
if(sSheets[i][0]!=""){
sourceSheets.push(sSheets[i]);
}
}
var dKeys = settings.getRange("A2:A").getValues();
var sKeys = [];
for(var i = 0; i < dKeys.length;i++){
if(dKeys[i][0]!=""){
sKeys.push(dKeys[i]);
}
}
var data = [];
for (var i= 0; i<sourceSheets.length;i++){
var values = ss.getSheetByName(sourceSheets[i]).getDataRange().getValues();
for (var x = 1;x < values.length; x++){
if(values[x][0]!= ""){
data.push(values[x]);
}
}
}
for (var i = 0; i< sKeys.length;i++){
var tss = SpreadsheetApp.openById(sKeys[i]);
var target = tss.getSheetByName(targetSheet);
var range = target.getRange(2,1, data.length, data[0].length);
target.getRange(2,1,target.getLastRow()-1,target.getLastColumn()).clearContent();
range.setValues(data);
}
}
Munkey provided some helpful comments to the script above to aid my understanding. Although the script works well, it doesn't pull data from my =image("")
formula in column "H".
Is there anyone who could assist in modifying the script to include the =Image("")
formula in the search tool, similar to how =importrange
functions? I've tried various methods like getFormula
and getFormulas
, but with no success so far. It's likely I'm just not using them correctly :)