I need to come up with the script for an import button on my google spreadsheet, but I'm a little out of my depth.
I have one Spreadsheet with two Sheets:
- Purchase Order template (Sheet2 = 発注書)
- Product Requirements data (Sheet3 = 朝食)
The goal is to populate the Purchase Order (Sheet2) from a row of Product Requirements data on Sheet3. The Product Requirements data includes a Purchase Order value.
What I'm trying to achieve is to import data from the second to the third tab in the following way:
- Enter a Purchase Order number in Cell B2, Sheet2.
- Manually start the macro (by click the "import" button) to copy data from Sheet3 to Sheet2.
- Find the row on Sheet3 where the value in Column A equals value entered into the Purchase Order Cell B2. Then, copy values from that row on Sheet3 to the Purchase Order (Sheet2)
- Column B - copy to Sheet2, Cell D16
- Column C - copy to Sheet2, Cell C15
- Column D - Copy to Sheet2, Cell D20
- Column E - copy to Sheet2, Cell D21
- Column G - copy to Sheet2, Cell D14
*Other columns do not need to be imported.
Basically, depending on the value I insert 発注書!B2 (Sheet2, B2), I can import different data from the 朝食 tab row. I apologize if it's not clear enough. I tried modifying the script based on an existing excel doc which used the formula but I failed.
This is a sample spreadsheet to illustrate what I'm trying to do: Sheet2 (朝食), and below Sheet3 (発注書）
VLOOKUPformula would be easiest, simplest way to do it. The formula is slightly different, but I'll show you what I mean.