Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3491596
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T11:39:22+00:00 2026-05-18T11:39:22+00:00

I’m trying to write a simple script for a Google Docs Spreadsheet. The two

  • 0

I’m trying to write a simple script for a Google Docs Spreadsheet. The two links below are a screenshot of the sheets I’m writing the script for.

I’m still learning how to write JavaScript but this is what I’m trying to do. I hope this makes sense. Can anyone help me with this?

get.sheetbyname "Purchase Orders"
    If column E  == "stock"
    var qty == three cells left of cell e
    var partNum == two cells left of cell e

get.sheetbyname "Parts inventory"
    loop through column C until you find partNum
    var oldQty == number(two cells left of partNum)
    add qty to oldQty to get new qty

​

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T11:39:23+00:00Added an answer on May 18, 2026 at 11:39 am

    You’ll definitely need to get familiar with JavaScript quickly. It’s a powerful language and seems easy to pick up but has many differences from other popular, seemingly related languages (e.g. Java, C, etc). Once you’re comfortable with JavaScript, you’ll want to familiarize yourself with the Google Apps Script Spreadsheet Services APIs. These APIs allow you to script Google Docs spreadsheets like you would other spreadsheet applications, such as Microsoft Excel. Start by opening your workbook and browsing to “Tools > Scripts > Script Editor…”, then creating a new named script.

    Here’s a start at what you’re trying to do specifically. It looks like you’re trying to find out how many purchase orders exist for some item and update the quantity in the inventory sheet.

    function updateInventoryFromPurchaseOrders() {
      var purchaseOrders = {}; // A mapping of partNumber => quantity.
      var ss = SpreadsheetApp.getActiveSpreadsheet();
      var sheet = ss.getSheetByName('Purchase Orders');
      if (sheet) {
        // For each row, if column "E" == "stock" then set partNumber, quantity.
        purchaseOrders[partNumber] = quantity;
      }
      // Now purchaseOrders should look like {'SL249':5, 'ML50':1, 'MWF':1}
    
      sheet = ss.getSheetByName('Inventory');
      if (sheet) {
        // For each row, set quantity, partNumber.
        var purchased = purchaseOrders[partNumber];
        // Set column "A" value = quantity + purchased
      }
    }
    

    Reading and writing the values from individual cells will require you to use Ranges, the docs linked above should give you enough examples to get you the rest of the way.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.