2

So, I'm in the situation where I have a Google Spreadsheet with people's names, phone numbers, addresses, etc.

Is it possible to, from another spreadsheet (not sheet, different workbook), search the directory spreadsheet for a name entered into a cell, and then pull certain data and populate it into the new sheet?

Essentially, I want to be able to have a new spreadsheet with a name, phone number, etc column, and have it auto populate the phone number (as well as other data) so I don't have to copy and paste.

Is this possible?

1 Answer 1

2

Yes. It is Possible. Just follow some simple steps:

  1. You create a custom function by writing scripts which will work like simple function inside a Spreadsheet cell for ex: =SUM(A1 +A2) by Opening the Google Spreadsheet(That acts like directory ie. Data like name,contacts etc) ->Click Tools->Click Script Editor...

A new window will openup and choose spreadsheet option .Here,you can write custom functions which looks like

enter image description here

Here you write functions (for more info,https://developers.google.com/apps-script/your_first_script#requirements)

2.You create a function that will open your Spreadsheet that contains behaves like directory. A sample function

function readRows()
{
var sheet = SpreadsheetApp.openById("0AszINz88nA9hdEkxa1FIS0wta1FLS2NPUzAyU0lOV1E")
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
var values = rows.getValues();
for (var i = 0; i <= numRows - 1; i++) { var row = values[i]; Logger.log(row); } };

For more info,https://developers.google.com/apps-script/reference/spreadsheet/spreadsheet-app#open(File)

You can Run and Test by pressing Run and selecting function, (it may require permission).

You can view the results in Log Window by Opening View->Logs.

That,it now you can use that function in that cell.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.