Skip to content

Commit b61ebd4

Browse files
committed
Add convertSpreadsheet() method.
1 parent c6d93b6 commit b61ebd4

3 files changed

Lines changed: 12 additions & 1 deletion

File tree

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ await wdp.convertHTMLToPDF(source, targetFilename);
7373

7474
// Convert HTML file to PDF
7575
await wdp.convertHTMLFileToPDF(sourceFilename, targetFilename);
76+
77+
// Convert spreadsheets
78+
await wdp.convertSpreadsheet(sourceFilename, targetFilename, 'xls');
7679
```
7780

7881
## Requirements

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@webdevpack/webdevpack-sdk-js",
3-
"version": "1.2.0",
3+
"version": "1.3.0",
44
"description": "WEBDEVPACK SDK for JavaScript (Node.js)",
55
"license": "MIT",
66
"homepage": "https://webdevpack.com/",

src/client.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,4 +230,12 @@ export class Client {
230230
});
231231
await this.#downloadFile(r.result.file, target);
232232
}
233+
234+
async convertSpreadsheet(source, target, format) {
235+
this.#checkSourceFilename(source);
236+
this.#checkTargetFilename(target);
237+
const fileID = await this.#uploadFile(source);
238+
const r = await this.#sendRequest("/v0/spreadsheet-convert", { file: fileID, format});
239+
await this.#downloadFile(r.result.file, target);
240+
}
233241
}

0 commit comments

Comments
 (0)