Store data in key-value pairs using OfficeScripts

Here are some examples of creating sample objects:

function createSampleObjects() {
  // Object with string values
  var person = {
    name: "John Doe",
    age: "30",
    occupation: "Engineer"
  };

  // Object with number values
  var product = {
    id: 12345,
    price: 9.99,
    quantity: 5
  };

  // Object with boolean values
  var settings = {
    isEnabled: true,
    isEditable: false,
    isResizable: true
  };

  // Object with mixed value types
  var car = {
    make: "Toyota",
    model: "Camry",
    year: 2022,
    isElectric: false
  };

  // Logging the objects
  console.log(person);
  console.log(product);
  console.log(settings);
  console.log(car);
}

In this example, four different objects are created with different types of values:

  1. person is an object that stores information about a person, such as their name, age, and occupation. The values are of type string.

  2. product is an object that represents a product, with properties like ID, price, and quantity. The values are of type number.

  3. settings is an object that holds various settings, such as whether certain options are enabled, editable, or resizable. The values are of type boolean.

  4. car is an object that represents a car, with properties like make, model, year, and whether it is electric. The values are of different types, including string, number, and boolean.

After creating the objects, the example logs the objects to the console, displaying their key-value pairs.

You can call the createSampleObjects function to see the objects and their properties in the console output.

Please note that OfficeScripts are only supported in Excel for the web and Excel Online, and they may have limitations compared to other programming environments.

Pamai Tech
Turning ideas into Reality

Products

Office Add-in

Enterprise Solutions

Cloud Consulting

UI UX Design

Data Transformation

Services

FAQ's

Privacy Policy

Terms & Condition

Team

Contact Us

Company

About Us

Services

Features

Our Pricing

Latest News

© 2023 Pamai Tech