https://github.com/autodesk-forge/viewer-javascript-extract.spreadsheet
Extract Revit Properties into Excel: This sample uses Model Derivative API endpoints to read a Revit project properties and create a XLSX Excel file with one sheet for each type/category with all objects on it
https://github.com/autodesk-forge/viewer-javascript-extract.spreadsheet
javascript model-derivative viewer xls
Last synced: 6 months ago
JSON representation
Extract Revit Properties into Excel: This sample uses Model Derivative API endpoints to read a Revit project properties and create a XLSX Excel file with one sheet for each type/category with all objects on it
- Host: GitHub
- URL: https://github.com/autodesk-forge/viewer-javascript-extract.spreadsheet
- Owner: Autodesk-Forge
- License: mit
- Created: 2017-02-15T17:52:45.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2022-12-11T00:19:13.000Z (almost 3 years ago)
- Last Synced: 2025-04-12T08:53:50.576Z (6 months ago)
- Topics: javascript, model-derivative, viewer, xls
- Language: JavaScript
- Homepage: https://viewerxls.autodesk.io
- Size: 13.9 MB
- Stars: 35
- Watchers: 14
- Forks: 25
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# viewer-javascript-extract.spreadsheet
JavaScript sample to extract Revit files from [Model Derivative API](https://developer.autodesk.com/en/docs/model-derivative/v2) as Spreadsheet (Excel XLSX)[](http://developer.autodesk.com/)
[](http://opensource.org/licenses/MIT)
[](http://developer.autodesk.com/)# Description
This sample uses Model Derivative API endpoints to read a Revit project properties and create a XLSX Excel file with one sheet for each type/category with all objects on it. Non-Revit files are not supported (different structure). [Here is another version](https://github.com/Autodesk-Forge/model.derivative-csharp-context.menu) for desktop.

## Demonstration
Run it live at [this page](https://viewerxls.autodesk.io), or locally by following these steps:
- create a Forge application if you don't have one yet ([tutorial](https://forge.autodesk.com/en/docs/oauth/v2/tutorials/create-app/))
- make sure you have at least one file prepared for viewing ([tutorial](https://forge.autodesk.com/en/docs/model-derivative/v2/tutorials/prep-file4viewer/))
- clone this git repository
- navigate to the repository root folder and install npm dependencies
- on Windows/macOS/Linux: `npm install`
- prepare required environment variables
- on Windows:
```
set FORGE_CLIENT_ID=
set FORGE_CLIENT_SECRET=
set FORGE_BUCKET=
```
- on macOS/Linux:
```
export FORGE_CLIENT_ID=
export FORGE_CLIENT_SECRET=
export FORGE_BUCKET=
```
- run the application
- on Windows/macOS/Linux: `npm run dev`
- go to http://localhost:3000# Usage
Add reference to the ForgeXLS file:
```
```
Then call **downloadXLSX** method passing the URN and a data:read token.
```
function downloadExcel() {
ForgeXLS.downloadXLS(theURN, token, statusCallback /*Optional*/);
}
```## Dependencies
This project depends on [Sheet JS](https://github.com/SheetJS/js-xlsx) to manipulate spreadsheet files. The [FileSaver](https://github.com/eligrey/FileSaver.js/) library is used to create & download a file on the client. [BlobJS](https://github.com/eligrey/Blob.js) is required for older browsers ([see compatibility](https://github.com/eligrey/FileSaver.js/#supported-browsers)). [jQuery](https://jquery.com) is also used.
```
```
# License
This sample is licensed under the terms of the [MIT License](http://opensource.org/licenses/MIT).
Please see the [LICENSE](LICENSE) file for full details.## Written by
Augusto Goncalves [@augustomaia](https://twitter.com/augustomaia), [Forge Partner Development](http://forge.autodesk.com)