testing123
testing123

Reputation: 831

apps script vlookup not found?

I rearranged some columns and now my code isn't working. I'm trying to use vlookup to get values from another table.

var name = ss.getRange('G'+lastRow);
name.setValue('=VLOOKUP("Form Responses_Images/"&B'+lastRow+',importrange("https://docs.google.com/spreadsheets/d/###","Form Responses!Q:AA"),8,false)');
SpreadsheetApp.flush();
name.copyTo(name,{contentsOnly:true});

The table that I need to fill in: enter image description here

The table that I am using to look up info: enter image description here

Right now when I run the script, the cell just freaks out and gives the error: Error Did not find value 'Form Responses_Images/20ba4a5c.Upload.040416.jpg' in VLOOKUP evaluation.

But as you can see both tables have the value Form Responses_Images/20ba4a5c.Upload.040416.jpg in it?

Upvotes: 0

Views: 186

Answers (1)

Marios
Marios

Reputation: 27350

You need to fix the importrange function and the column index. Start from column V and get the 3rd column after that.

Replace:

name.setValue('=VLOOKUP("Form Responses_Images/"&B'+lastRow+',importrange("https://docs.google.com/spreadsheets/d/###","Form Responses!Q:AA"),8,false)');

with:

name.setValue('=VLOOKUP("Form Responses_Images/"&B'+lastRow+',importrange("https://docs.google.com/spreadsheets/d/###","Form Responses!V:AA"),3,false)');

Upvotes: 1

Related Questions