D
D
Dimanoff2022-01-28 19:27:35
Google Apps Script
Dimanoff, 2022-01-28 19:27:35

How to compare data on two Google Sheets to track the movement of goods?

We are engaged in the sale of goods (piece).
I keep records in Google Sheets. The table consists of three sheets:
1. A sheet where I periodically upload a table from 1C (upload). It contains a list of goods, basic characteristics and serial numbers (unique).
2. Sheet containing a copy of the upload to track changes (archive).
3. A sheet on which the base is collected from the archive, where I make additional notes, statuses, and analytics.
The product can be added (receipt), disappear (sold), or change (the product has a customer or vice versa, refuses, and the product is released). Parameters may change (price, comments in the download).
I need to make a script so that when a button is clicked, the following happens:
1. The function went through the serial numbers in the download and checked if these numbers were in the archive.
2. If there is no number, then I added a new line with the goods to the archive.
3. If there is a number, then I updated all the data on it in the line.
4. If the number is in the archive, but disappeared in the unloading, then in the archive I put a note next to the line that the goods were sold.
5. If the product returned to unloading, then it did not create a duplicate, but unmarked the sale of the product and updated the fields in accordance with clause 3.

Help to make a script, please.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Ivanov, 2022-03-10
@Dimanoff

For such a script, it is enough to take data from the archive, convert the array to a flat one (index) for convenience, and search by this index. The rest can be found online.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question