0% found this document useful (0 votes)
8 views2 pages

Codee

The function organizes keyword data from all sheets in a Google Spreadsheet, creating formatted output sheets for each source sheet except the 'Formatted Data' sheet. It processes subcategories, inserting headers and hyperlinks to URLs, and populates keyword data along with search volume and intent. Finally, it alerts the user upon successful formatting of the data.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views2 pages

Codee

The function organizes keyword data from all sheets in a Google Spreadsheet, creating formatted output sheets for each source sheet except the 'Formatted Data' sheet. It processes subcategories, inserting headers and hyperlinks to URLs, and populates keyword data along with search volume and intent. Finally, it alerts the user upon successful formatting of the data.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd

function organizeKeywordDataFromAllSheets() {

var sheet = [Link]();


var allSheets = [Link]();
var subcategoryUrls = {
"BEDS": "[Link]
"DRESSERS & CHESTS": "[Link]
// Add more subcategories and their URLs here
};

[Link](sourceSheet => {
var sheetName = [Link]();
if (sheetName === "Formatted Data") return; // Skip the output sheet to prevent
overwriting

var targetSheetName = sheetName + " - Formatted"; // Create a unique name for


each processed sheet
var targetSheet = [Link](targetSheetName) ||
[Link](targetSheetName);
[Link](); // Clear any previous data

var data = [Link]().getValues();


if ([Link] < 2) return; // Skip empty sheets

var outputRow = 1;
var processedSubcategories = {};

for (var i = 1; i < [Link]; i++) {


var subcategory = data[i][1]; // Sub-category column
var keyword = data[i][2]; // Keyword column
var searchVolume = data[i][3]; // Search Volume column
var intent = data[i][4]; // Intent column

if (!processedSubcategories[subcategory]) {
// Insert Page Status Header
[Link](outputRow, 1).setValue("Page Status");
[Link](outputRow, 2).setValue("Existing");

// Insert Hyperlinked URL


var url = subcategoryUrls[subcategory] || "#";
var cell = [Link](outputRow, 3);
[Link]('=HYPERLINK("' + url + '", "' + subcategory + '")');

outputRow++;

// Insert Column Headers


[Link](outputRow, 1, 1, 3).setValues([["Keyword", "Search
Volume", "Intent"]]);

outputRow++;
processedSubcategories[subcategory] = true;
}

// Insert Keyword Data


[Link](outputRow, 1, 1, 3).setValues([[keyword, searchVolume,
intent]]);
outputRow++;
}
});

[Link]().alert("Data has been successfully formatted in separate


tabs for each sheet!");
}

You might also like