সেভ করা পৃষ্ঠা গুছিয়ে রাখতে 'সংগ্রহ' ব্যবহার করুন আপনার পছন্দ অনুযায়ী কন্টেন্ট সেভ করুন ও সঠিক বিভাগে রাখুন।
আপনি একটি কাস্টম ফাংশন লিখতে Google Apps স্ক্রিপ্ট ব্যবহার করতে পারেন, তারপরে এটি একটি অন্তর্নির্মিত ফাংশনের মতো Google পত্রকগুলিতে ব্যবহার করতে পারেন৷
নিম্নলিখিত কুইকস্টার্ট নমুনাটি একটি কাস্টম ফাংশন তৈরি করে যা ছাড় পাওয়া আইটেমগুলির বিক্রয় মূল্য গণনা করে। বিক্রয় মূল্য US ডলার হিসাবে ফর্ম্যাট করা হয়.
উদ্দেশ্য
স্ক্রিপ্ট সেট আপ করুন।
স্ক্রিপ্ট চালান।
পূর্বশর্ত
এই নমুনা ব্যবহার করতে, আপনার নিম্নলিখিত পূর্বশর্ত প্রয়োজন:
একটি Google অ্যাকাউন্ট (Google Workspace অ্যাকাউন্টের জন্য অ্যাডমিনিস্ট্রেটরের অনুমোদনের প্রয়োজন হতে পারে)।
একটি ঘরে, =salePrice(100,.2) লিখুন। প্রথম প্যারামিটারটি আসল মূল্য এবং দ্বিতীয় প্যারামিটারটি ডিসকাউন্ট শতাংশ প্রতিনিধিত্ব করে। আপনি যদি দশমিক কমা ব্যবহার করে এমন একটি অবস্থানে থাকেন, তাহলে আপনাকে এর পরিবর্তে =salePrice(100;0,2) লিখতে হবে।
আপনি কক্ষে যে সূত্রটি প্রবেশ করান তা পূর্ববর্তী বিভাগে আপনার তৈরি স্ক্রিপ্টে ফাংশনটি চালায়। ফাংশনটির বিক্রয় মূল্য $80.00 হয়।
পরবর্তী পদক্ষেপ
অ্যাপস স্ক্রিপ্টের সাহায্যে শীটগুলি কীভাবে প্রসারিত করা যায় সে সম্পর্কে শেখা চালিয়ে যেতে, নিম্নলিখিত সংস্থানগুলি দেখুন:
[[["সহজে বোঝা যায়","easyToUnderstand","thumb-up"],["আমার সমস্যার সমাধান হয়েছে","solvedMyProblem","thumb-up"],["অন্যান্য","otherUp","thumb-up"]],[["এতে আমার প্রয়োজনীয় তথ্য নেই","missingTheInformationINeed","thumb-down"],["খুব জটিল / অনেক ধাপ","tooComplicatedTooManySteps","thumb-down"],["পুরনো","outOfDate","thumb-down"],["অনুবাদ সংক্রান্ত সমস্যা","translationIssue","thumb-down"],["নমুনা / কোড সংক্রান্ত সমস্যা","samplesCodeIssue","thumb-down"],["অন্যান্য","otherDown","thumb-down"]],["2025-08-04 UTC-তে শেষবার আপডেট করা হয়েছে।"],[[["\u003cp\u003eGoogle Apps Script allows you to create custom functions that can be used directly within Google Sheets, similar to built-in functions.\u003c/p\u003e\n"],["\u003cp\u003eThis tutorial demonstrates how to build a custom function that calculates and formats sale prices based on provided input and discount values.\u003c/p\u003e\n"],["\u003cp\u003eTo use the custom function, simply paste the provided code into the Apps Script editor linked within your Google Sheet and call it using \u003ccode\u003e=salePrice(input, discount)\u003c/code\u003e in any cell.\u003c/p\u003e\n"]]],[],null,["You can use Google Apps Script to write a custom function, then use it in\nGoogle Sheets just like a built-in function.\n\nThe following quickstart sample creates a custom function that calculates the\nsale price of discounted items. The sale price is formatted as US dollars.\n\nObjectives\n\n- Set up the script.\n- Run the script.\n\nPrerequisites\n\nTo use this sample, you need the following prerequisites:\n\n- A Google Account (Google Workspace accounts might require administrator approval).\n- A web browser with access to the internet.\n\nSet up the script\n\n1. Create a [new\n spreadsheet](https://sheets.google.com/create).\n2. From within your new spreadsheet, select the menu item **Extensions** \\\u003e **Apps Script**.\n3. Delete any code in the script editor and paste in the code below. Then\n click Save .\n\n ```scilab\n /**\n * Calculates the sale price of a value at a given discount.\n * The sale price is formatted as US dollars.\n *\n * @param {number} input The value to discount.\n * @param {number} discount The discount to apply, such as .5 or 50%.\n * @return The sale price formatted as USD.\n * @customfunction\n */\n function salePrice(input, discount) {\n let price = input - (input * discount);\n let dollarUS = Intl.NumberFormat(\"en-US\", {\n style: \"currency\",\n currency: \"USD\",\n });\n return dollarUS.format(price);\n }\n ```\n\nRun the script\n\n1. Switch back to your spreadsheet.\n2. In a cell, enter `=salePrice(100,.2)`. The first parameter represents the original price and the second parameter represents the discount percentage. If you're in a location that uses decimal commas, you might need to enter `=salePrice(100;0,2)` instead.\n\nThe formula that you enter in the cell runs the function in the\nscript you created in the previous section. The function results in a sale\nprice of `$80.00`.\n\nNext steps\n\nTo continue learning about how to extend Sheets with\nApps Script, take a\nlook at the following resources:\n\n- [Spreadsheet custom functions](/apps-script/execution_custom_functions)\n- [Custom menus in Google Workspace](/apps-script/guides/menus)\n- [Extend Google Sheets](/apps-script/guides/sheets)"]]