PancakeSpreadsheet α: Read / write xls(x) files without Excel

This plugin makes use of the NPOI library which allows you to manipulate xls(x) files without Excel installed and it is faster. It should work both on Windows and macos but macos isn’t tested.

If you need to write Excel files / modify opened spreadsheet, please use flow control components (e.g. Wait Until) to make sure they are sequentially ordered otherwise the result is unreliable.

This plugin is still in the alpha stage, and may contain unknown bugs.

Backup files especially when you are writing xls(x) files. Don’t hesitate to contact me or leave a reply here if you run into something. Most of writing components aren’t thoroughly tested. Advice is also welcome.

It would have a few more features if Pancake is installed but it will work without it.

5 Likes

Can you provide a example file for this?

1 Like

File needs to be a file path instead of a directory, e.g. D:\test\a.xlsx.
And it’s probably not gonna be saved if there’s no sheet in the workbook.

image

simple_write_xlsx.gh (8.6 KB)

1 Like

Thank you. It works

Released on food4rhino.

Hi what needs to be the inputs for the “set cell style” component. Imnot sure what should be in the “value” input. thanks

Generally it’s not quite supported and it is a future feature to be implemented.

The possible style names includes:

alignment
borderBottom
borderLeft
borderRight
borderTop
bottomBorderColor
dataFormat
fillBackgroundColor
fillBackgroundColorColor
fillForegroundColor
fillForegroundColorColor
fillPattern
font
hidden
indention
leftBorderColor
locked
quotePrefixed
rightBorderColor
rotation
shrinkToFit
topBorderColor
verticalAlignment
wrapText

You can search for examples on CellUtil.SetCellStyleProperties for manipulating cell styles.

Hi @gankeyu,

Thanks for the plugin! This is the best Excel plugin I found in my trials. I am currently using this setup to read Excel files, in which I use Human’s item selector to reference the sheet name.

I use (very light) Excel tables do drive my script to generate geometry and would like to request an update toggle/ node input (to refresh the spreadsheet coming in to Grasshopper). I prefer this to be at the spreadsheet level, to prevent the item selector from updating as well (and defaulting back to another sheet).

I’m afraid a spreadsheet must be reloaded entirely, due to limitations of the underlying mechanism.

I would propose a workaround of using two Open Spreadsheet components, one for sheet name and one for actual read, and there could be two reloading toggles, one “bigger” one would also trigger the other one.

1 Like

That’s a good point, works well.

I’m trying to apply data from a sheet based on attributes. For instance, I have curves that have the attribute ‘Tram’ which I would like use to set the width of the street, similarly, I could have a sheet called ‘Alley’ which i would use to generate tiny streets with.

I have been trying to read all sheets within the file by grafting the spreadsheet input for the sheet identifier in the Simple read XLS component, but the component does not maintain data order whatsoever when I do this. Is that something you could support in the future? Meaning, you could create a tree branch for each spreadhseet and have a component with a spreadsheet index which then returns the specific spreadsheet branch.

May you upload an example file?

@gankeyu Yes, of course.

I would like to avoid these kinds of spaghetti wiring shenanigans:

The procedure I am using is in this file below:
XLS sheets to tree branches.gh (17.6 KB)
Added the XLS as zip:
Sample table.zip (11.9 KB)

my apolgoies i’ve been busy recently.

I need sometime to diagnose with the “formatted table” issue on GitHub and come up with a workaround to tackle the issue here.

1 Like

Yes, thanks for the comments. I will take a look at each and check the proposed solutions, thank you!

Hi @gankeyu, I was looking around to see whether there are any Grasshopper plugins that allow you to add/ modify spreadsheets within the Grasshopper canvas (or with a pop-up). Unfortunately, the two solutions that I found are not scaling with my 4k monitor.

I was wondering, would you be interested in expanding Pancake Spreadsheet to include an on-canvas spreadsheet editing component? The two plugins that do this are built on top of Reogrid: https://reogrid.net/

There’s already this open repository to use as base: GitHub - mahdiyargit/TableDataInput: A small Grasshopper plug-in based on the ReoGrid .NET Spreadsheet.

I’ll take a look. Anyway it won’t be a part of PancakeSpreadsheet (most likely a standalone plugin) because it won’t be cross-platform.

1 Like