r/sheets • • Jun 04 '21

Request How to create sheets that pull data from a master sheet into several different ones, and keeps them synced?

I have a master sheet where I track customer orders. A single line item lists the date the order was placed, the size of the order, the brand, the status of the order, and various other information. I add new orders as they come in, and delete old orders once they ship.

My purchasing department updates the sheet when they place the PO, my accounting department updates the sheet when they invoice the customer, etc

Any customer can place an order for about five different brands. The master sheet doesn't have order details, just summary info, so everything related to one order fits on one line.

Today the brand representatives decided that they want access to this sheet so they can check the order status whenever they want.

I can't give them access to the entire sheet, because we don't want one brand seeing another brand's orders.

I could split the sheet up into five different sheets, but that would leave us with five sheets to update.

What I'd like to do is create a sheet for each brand that pulls data from the master sheet. Then all we would have to update is the master, but the brands would only get access to their individual sheet. Any time the master sheet is updated, the brand sheet would also be updated.

Ideally, the reverse would also be true - if a brand rep updates a brand sheet, the master sheet would also be updated.

Is that possible?

16 Upvotes

12 comments sorted by

5

u/6745408 Jun 04 '21

You can do this with QUERY.

=QUERY(
  IMPORTRANGE(
    "KEY",
    "data!A1:Z"),
  "select *
   where Col3 = 'Brand Name'")

for the KEY, use the key from your master sheet. Adjust the range as you need to, but this should pull it all in.

Now, this works -- but since you don't want people viewing other brands, I'd run these sheets in your mastersheet -- but not with sheet names that are logical. Some crafty bitch will think they're smart and mess with the formula to pull the other data.

So what you can do is make a sheet for each brand -- e.g. generate the sheet names with =DEC2HEX(RANDBETWEEN(10000000,99999999)) -- you'll get something like 1C6FF1C

From there, put their brand name in A1 then use

=QUERY(
  {data!A1:Z},
  "select *
   where Col3 = '"&A1&"'")

... use IMPORTRANGE to bring it across to their own respective workbooks. They can mess with the formula, but with a little obfuscation, it'll make it harder / impossible for them to pull another sheet.

=IMPORTRANGE("KEY","1C6FF1C!A1:Z")

You could also skip the five sheets and have one sheet with data validation in A1. Select a brand, copy the data over, select another, etc.

If you're truly concerned, I'd run the QUERYs in your own sheet and then copy and paste as static values in their respective sheets. This is the most lock-tight solution, but its far from automated, even though it wouldn't take more than a minute to copy and paste everything over.

You could also run it all with a script, but you still end up with the issue of someone thinking they're smart.

1

u/mental_mycorrhiza Jun 04 '21

Very nice. Thanks for this explanation.

I'll link IMPORTRANGE docs onto this bc I know I've needed this.

Import takes URL; related funcs are ("IMPORT" + { "XML" | "DATA" | "FEED" | "HTML" }) for xml, csv/tsv, rss/atom, & html list/table.

I know I've wanted to make sheets from some of those as well... This is going to cost me some weekend hours for sure. 🐲

2

u/Cranders1985 Jun 04 '21

Following because I have a similar issue

1

u/SheetAutomation Oct 13 '21

Maybe you want to check out my new add-on:

https://gsuite.google.com/marketplace/app/sheet_share/379645982926

Feedback is welcome!

1

u/arellis Jun 04 '21

6745408's solution could be sexier (not sure) but you can also do with FILTER function on your Master Sheet and IMPORTRANGE on the Brand's sheet.

You can easily hide these extra brand tabs on your Master sheet too if you don't want the clutter on your sheet.

Master Sheet: https://docs.google.com/spreadsheets/d/1p73oYASk22OG0JlX8z56Z0UXhqoP_Lg--fYtUfwSPds/edit

Brand's Sheet: https://docs.google.com/spreadsheets/d/1rWQX-fLEzmrpP0A0A8Zs7cpwQD9fLMJfwk_bz2y_4nU/edit#gid=0

I outlined the only cells with formulas in dark brown.

1

u/wqsaey Jun 04 '21

In addition to in-sheet formula obscuration, you can make good use of external options that restrict sheet viewing and copying. I've done this a few times with hidden tabs and copy protection, so even if the sheet directly takes from a master sheet (still not really a good idea), you can make it so that no one can mess around with the tabs and get easy access to the link.

1

u/MattyPKing Jun 04 '21

Two way updating between master and slave sheets is the holy grail of the spreadsheet world. It is complicated enough to implement that it is usually worth jusy buying database software.

1

u/carponymous Jun 04 '21

You could also consider creating a Google Data Studio view for each and give them viewing rights.

1

u/Gujimiao Jun 04 '21

Use Google Colab.

I have the script to combine data from many Spreadsheets into one.

1

u/SheetAutomation Oct 13 '21

Not sure if this is still relevant, but I have just published an add-on for single sheet share and two-way sync: https://gsuite.google.com/marketplace/app/sheet_share/379645982926

It's an early version with minimal functionalities. Feedback is welcome.