This tutorial assists in adding Excel formula using Node.js REST API. You will learn how to input formulas into Excel using Node.js RESTful Service with a Node.js-based Could SDK. It shares the complete process starting with uploading the source Excel file and downloading the updated Excel file with the formula.
Prerequisite
- Create an account and get API credentials for setting a formula
- Download Aspose.Cells Cloud SDK for Node.js to insert a formula
- Setup Node.js project with the above SDK
Steps for Inserting Formulas in Excel using Node.js-based API
- Set up the Aspose.Cells Cloud API client using CellsApi with your credentials with Client ID, Client Secret, and Base URL
- Specify the name of the Excel file that will be processed
- Prepare a request to upload the local Excel file to Aspose’s cloud environment and execute the upload
- Create a request to insert a formula =NOW() with the PostWorksheetCellSetValue() method into a specified cell D1 in a particular worksheet of the uploaded file
- Request to download the updated Excel file from cloud storage
- Write the downloaded file stream to a local file
- Wrap the entire process in a try-catch block to handle and report any exceptions that may occur during execution
These steps express how to insert a formula in Excel using Node.js-based API. The program authenticates with Aspose.Cells Cloud, uploads an Excel file, inserts a formula (=NOW()) into a specific cell on a worksheet, and downloads the updated file. It handles any exceptions during the process and saves the final file locally.
Code for Entering Formulas in Excel using Node.js Low Code API
This sample code has demonstrated how to put a formula in Excel using Node.js REST Interface. You can add multiple formulas by creating a dictionary containing multiple Excel formulas mapped to specific cell addresses on a worksheet. Then iterate through each entry and use the Aspose.Cells Cloud API to insert the corresponding formula into the specified cell in the Excel file.
This article has taught us putting formulas in Excel using Node.js REST API. For unmerging cells in an Excel file, refer to the article on Unmerge cells in Excel using Node.js REST API.