Building whole sheet programmatically with Python

2019-08-02 19:30发布

I'm trying to build a whole sheet from scratch, and stay efficient while doing it. For that purpose, I am trying to rely on bulk operations.

I can build a massive list of rows and add them easily using add_rows().

However, I need some rows to be children of other rows, and neither row.indent nor row.parent_id seem possible to set on new rows (since the fresh rows don't have an id yet).

I could possibly: create the parent row > add_rows() > get_sheet() > find the row id in sheet > create the child row > add_rows() but I'm losing the benefits of bulk operations.

Is there any way at all so set child/parent relationships in python before ever communicating with the smartsheet server?

[Edit] Alternatively, a way to export an excel file via the SDK (or other) would also work, as I'm able to create my table with xlsxwrite and upload it manually to smartsheet at the moment. (Which is not an option, as we're trying to generate dozens of sheets, multiple times a day, got to automate it.)

Thanks

1条回答
我想做一个坏孩纸
2楼-- · 2019-08-02 19:39

You cannot create a sheet with hierarchy in a single call. All rows in a single POST or PUT must have the same location specifier.

You can either:

(1) Add all rows as a flat list, then indent each contiguous group of child rows. Repeat down the hierarchy.

(2) Add top level rows, then add each contiguous group of indented rows

查看更多
登录 后发表回答