An open API service indexing awesome lists of open source software.

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

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)

[![Viewer](https://img.shields.io/badge/Viewer-v7-green.svg)](http://developer.autodesk.com/)
[![License](http://img.shields.io/:license-mit-blue.svg)](http://opensource.org/licenses/MIT)
[![Model-Derivative](https://img.shields.io/badge/Model%20Derivative-v2-green.svg)](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.

![thumbnail](/thumbnail.png)

## 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)