{"id":19152397,"url":"https://github.com/neooblaster/-testcomplete-excelhandler","last_synced_at":"2026-06-20T11:32:28.375Z","repository":{"id":57165640,"uuid":"492784917","full_name":"neooblaster/-testcomplete-ExcelHandler","owner":"neooblaster","description":"An interface to perform Keyboard (and some Mouse) actions in an easier way","archived":false,"fork":false,"pushed_at":"2022-06-10T13:59:05.000Z","size":266,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-03T22:49:27.630Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/neooblaster.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-05-16T10:22:18.000Z","updated_at":"2022-05-16T10:22:39.000Z","dependencies_parsed_at":"2022-08-30T15:10:22.000Z","dependency_job_id":null,"html_url":"https://github.com/neooblaster/-testcomplete-ExcelHandler","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neooblaster%2F-testcomplete-ExcelHandler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neooblaster%2F-testcomplete-ExcelHandler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neooblaster%2F-testcomplete-ExcelHandler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neooblaster%2F-testcomplete-ExcelHandler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/neooblaster","download_url":"https://codeload.github.com/neooblaster/-testcomplete-ExcelHandler/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240236361,"owners_count":19769580,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T08:17:39.371Z","updated_at":"2026-06-14T17:30:21.688Z","avatar_url":"https://github.com/neooblaster.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TestComplete - ExcelHandler Interface\r\n\r\n\u003e An interface to perform Keyboard (and some Mouse) actions in an easier way.\r\n\r\n* **Version** : ``v0.3.3``\r\n* **Compatibility** : **TestComplete** only\r\n* **Script** : ``./node_modules/@testcomplete/excelhandler/ExcelHandler.js``\r\n* **Dependencies** :\r\n    * ``TableJs`` : [@neooblaster/tablejs](https://www.npmjs.com/package/@neooblaster/tablejs)\r\n        * ``./node_modules/@neooblaster/tablejs/Bin/Table.js``\r\n* **Test Project** : ``./test/ExcelHandlerTest.pjs``\r\n\r\n\r\n\r\n## Summary\r\n\r\n[](BeginSummary)\r\n* [Summary](#summary)\r\n* [ExcelHandler Setup for TestComplete](#excelhandler-setup-for-testcomplete)\r\n* [Get Started with ExcelHandler](#get-started-with-excelhandler)\r\n* [CheatSheet](#cheatsheet)\r\n    * [Main Information](#main-information)\r\n    * [Loading Library](#loading-library)\r\n    * [Instantiation](#instantiation)\r\n    * [Initialization](#initialization)\r\n    * [Switching between Workbook sheets](#switching-between-workbook-sheets)\r\n    * [Specifying the data starting line](#specifying-the-data-starting-line)\r\n    * [Defining the column name](#defining-the-column-name)\r\n    * [Getting Cell data](#getting-cell-data)\r\n    * [Updating Cell data](#updating-cell-data)\r\n    * [Getting the Excel data as table](#getting-the-excel-data-as-table)\r\n    * [Closing / Saving the Excel file](#closing-saving-the-excel-file)\r\n[](EndSummary)\r\n\r\n\r\n\r\n## ExcelHandler Setup for TestComplete\r\n\r\nAs this library is published on **npmjs**,\r\nyou can easily get library with the following command\r\nif you have **nodejs** installed on your computer.\r\n\r\n````bash\r\nnpm install @testcomplete/excelhandler\r\n````\r\n\r\nPlease confer to this documentation to add script in TestComplete :\r\n\r\nScript List for the setup :\r\n\r\n* ``./node_modules/@neooblaster/tablejs/Bin/Table.js``\r\n* ``./node_modules/@testcomplete/excelhandler/ExcelHandler.js``\r\n\r\n[@testcomplete/testcompletelibrarysetup](https://www.npmjs.com/package/@testcomplete/testcompletelibrarysetup)\r\n\r\n\r\n\r\n## Get Started with ExcelHandler\r\n\r\nTo simplify scripting, \r\n**Excel** file must have an header line\r\nwhere the name must only contains following chars :\r\n\r\n- Letters from **a** to **z** (Lower \u0026 Uppercase (case sensitive))\r\n- Numbers but header name must not start with a number\r\n- Spaces are permitted but in scripting, generated methods will trim space char.\r\n\r\nThese rules exist because, headers are used to generate methods on the instance\r\nfrom the interface ``ExcelHandler``.\r\n\r\nFor instance, if you have the following **Excel** File :\r\n\r\n| Line | A | B | C | D | E |\r\n|---|---|---|---|---|---|\r\n| 1 | Warehouse | Material | Prod Ord | TR | Quantity |\r\n| 2 | SA1 | K00289 | 20001467 | 85504 | 6 |\r\n \r\n````js\r\n// Loading Library\r\nconst ExcelHandler = require('ExcelHandler');\r\n\r\n// Instantiation Step\r\nlet ExcelHdl = new ExcelHandler('\u003cpath\u003e').open().sheet('DATA');\r\n\r\n// Dynamic methods available from header line :\r\nlet Warehouse = ExcelHdl.Warehouse(2); // Col A -\u003e Warehouse -\u003e line 2 = SA1\r\nlet Material  = ExcelHdl.Material(2);  // Col B -\u003e Material  -\u003e line 2 = K00289\r\n\r\n// This one, Method has been adjusted to meet JavaScript Function naming convention rule\r\n// by trimming space\r\nlet ProdOrd   = ExcelHdl.ProdOrd(2);   // Col C -\u003e Prod Ord  -\u003e Line 2 = 20001467\r\n\r\n// Updating Cell\r\nExcelHdl.Quantity(2, 12);   // Col E -\u003e Quantity -\u003e Line 2 become 12 instead of 6\r\n\r\n// Save modifications\r\nExcelHdl.save();\r\n````\r\n\r\n\r\n\r\n## CheatSheet\r\n\r\n### Main Information\r\n\r\nThis cheat sheet omit advanced details to be the more concise as \r\npossible while resuming the most common features \u0026 usage.\r\n\r\n* ``ExcelHandler`` considers your Excel File has an header line.\r\n* In consequence, by default, data start at line ``2``.\r\n* ``ExcelHandler`` trims spaces in the text of the header line to\r\npropose valid method name.\r\n* Special Char are not allowed in the header line.\r\n* An header line named ``Prod Order`` will generates the method\r\n``ProdOrder()``.\r\n* All method presented in the current cheat sheet can be chained.\r\n\r\n\r\n\r\n### Loading Library\r\n\r\n* Instruction to insert at the beginning of the script to get\r\nconstructor ``ExcelHandler`` :\r\n\r\n````js\r\nlet ExcelHandler = require('ExcelHandler');\r\n````\r\n\r\n\r\n### Instantiation\r\n\r\nInstruction to place in your TC Script function :\r\n\r\n````js\r\nlet ExcelHdl = new ExcelHandler('/path/to/excel/file');\r\n````\r\n\r\n\r\n\r\n### Initialization\r\n\r\nFrom your ``ExcelHandler`` instance, open the **Excel File** : \r\n\r\n````js\r\nExcelHdl.open();\r\n````\r\n\r\n\r\n\r\n### Switching between Workbook sheets\r\n\r\nYou can at anytime, switch to provided sheet of the workbook.\r\nCan be called only after ``.open()``.\r\n\r\n````js\r\nExcelHdl.sheet('YouExcelSheetName');\r\n````\r\n\r\n\r\n\r\n### Specifying the data starting line\r\n\r\nIf your data does not start at line ``2``,\r\nuse the following method to set the new line :\r\n\r\n````js\r\nExcelHdl.rowStartAt(3); // where 3 is the line number\r\n````\r\n\r\n\r\n\r\n### Defining the column name\r\n\r\nYou can specify your own column name for :\r\n\r\n* Overwriting a column with a wrong name \r\n* Setting up a new column\r\n\r\n````js\r\nExcelHdl.cols({\r\n    \"YourColumnName\": \"ExcelColumnChar\",    // \u003c\u003c Def\r\n    \"ProdOrder\": \"A\"                        // \u003c\u003c Exemple\r\n});\r\n````\r\n\r\nColumn definition is applied for the current workbook sheet.\r\nIf you switch to a new sheet. You have to repeat \r\nthe definition (if needed).\r\n\r\n**Note** : Any modifications made on Excel regarding columns order will \r\naffect definitions set with method ``cols()``.\r\n(if `ExcelColumnChar` is hardcoded). \r\n\r\n\r\n\r\n### Getting Cell data\r\n\r\nYou can get any data of the Excel by calling the generated\r\nmethod thanks to the header line (or you overwrite definition\r\nthanks to `cols()`). Dynamic method accepts **one** argument which\r\nis the **Excel Line**.\r\n\r\n````js\r\nlet sProdOrderNr = ExcelHdl.ProdOrder(2);\r\n````\r\n\r\n\r\n\r\n### Updating Cell data\r\n\r\nYou can set any data of the Excel by calling the generated\r\nmethod thanks to the header line (or you overwrite definition\r\nthanks to `cols()`). \r\nDynamic method accepts **two** arguments in this case where\r\nthe first one stands for the **Excel Line** and the second one stands for the\r\n**value** to enter in the cell.\r\n\r\n````js\r\nExcelHdl.Quantity(2, 12);\r\n````\r\n\r\n\r\n\r\n### Getting the Excel data as table\r\n\r\nYou can get the entire Excel File data in a JavaScript **array**\r\nthank to the method ``table()``.\r\n\r\n````js\r\n// Will return the data of the active sheet\r\nlet aExcelData = ExcelHdl.table(); // Return TableJs Array\r\n````\r\n\r\nNotes :\r\n\r\n``table()`` method returns an `Array` which has all natives JavaScript methods.\r\nBut in reality, the returned object is an instance of ``TableJs`` \r\nwhere all features are\r\ndocumented here : [@neooblaster/tablejs](https://www.npmjs.com/package/@neooblaster/tablejs)\r\n\r\n\r\n\r\n### Closing / Saving the Excel file\r\n\r\n* You can save and exit the Excel file with :\r\n\r\n````js\r\nExcelHdl.save();     // Only write change in Excel\r\n// or\r\nExcelHdl.save(true); // Will also clear handler on Excel File \u0026 Sheet\r\n````\r\n\r\n* You can leave (with save) the Excel file :\r\n\r\n````js\r\nExcelHdl.close();       // Exit witout save\r\n// or\r\nExcelHdl.close(true);   // Save \u0026 Exit\r\n````","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneooblaster%2F-testcomplete-excelhandler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneooblaster%2F-testcomplete-excelhandler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneooblaster%2F-testcomplete-excelhandler/lists"}