Fill Table Data in a Word DOCX File in Node.JS

Cloudmersive
2 min readAug 25, 2021

We know how difficult it can be to edit an online document, which is why we continue to develop tools to assist you with the undertaking. Today, we will be demonstrating how you can use an API solution in Node.JS to transform your Word DOCX files by instantly filling in pre-existing tables with data.

To begin, we will run this command to install the SDK:

npm install cloudmersive-convert-api-client --save

Or, we can add this snippet to our package.json:

"dependencies": {
"cloudmersive-convert-api-client": "^2.6.3"
}

Now, we simply need to input the request data and our API key into the following code:

var CloudmersiveConvertApiClient = require('cloudmersive-convert-api-client');
var defaultClient = CloudmersiveConvertApiClient.ApiClient.instance;
// Configure API key authorization: Apikey
var Apikey = defaultClient.authentications['Apikey'];
Apikey.apiKey = 'YOUR API KEY';
var apiInstance = new CloudmersiveConvertApiClient.TransformDocumentApi();var request = new CloudmersiveConvertApiClient.DocxTableTableFillRequest(); // DocxTableTableFillRequest |var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
apiInstance.transformDocumentDocxTableFillInEditSession(request, callback);

With this quick tool, you will now be able to replace placeholder rows with very little effort. If you need to retrieve your API key, you can do so by registering for a free account on the Cloudmersive website; this provides 800 calls/month across all of our APIs.

--

--

Cloudmersive

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.