Quantcast
Channel: Hot Weekly Questions - Web Applications Stack Exchange
Viewing all articles
Browse latest Browse all 9704

Get Table Name With Apps Script

$
0
0

I have two tables, namely Table A and Table B. Each table I want to identify the name of the table in column Cmatches the table names that have been defined in column A.

The script I've made is like this:

tableName () function {  let ss = SpreadsheetApp.getActiveSpreadsheet ();  let cColumn1 = ss.getRange ('C3: C7');  let cColumn2 = ss.getRange ('C11: C15');  let tableName1 = ss.getRange ('C2'). getValue ();  let tableName2 = ss.getRange ('C9'). getValue ();  cColumn1.setValues   (tableName1);  cColumn2.setValues   (tableName2);}

But my script is still manual, we have to specify the start line and end line of the table.To identify the name of the table I've ever made with a formula, so with this formula, we don't need to specify the positionthe name of the reference table.

= ARRAYFORMULA (IF ((B: B = "") + (B: B = "Name") ,, VLOOKUP (ROW (A: A), IF (LEN (REGEXEXTRACT (A: A, "T\D+") ), {ROW (A: A), REGEXEXTRACT (A: A, "T\D+")}, 0), 2)))

This formula is very heavy if the amount of data is large.

My Spreadsheet.


Viewing all articles
Browse latest Browse all 9704

Latest Images

Trending Articles



Latest Images