Export table including rich-text

Hi, I have a pretty simple request which seems difficult to accomplish on Fibery – maybe someone sees a possibility via API or scripting?

I have convinced our Fundraising specialist to move from Excel sheets to Fibery, as the information volume got too big and the first problems like having unsynchronized information pieces within different sheets started showing up.

Use case:
She needs to be able to print a table with all the information and status updates of all entities (= potential donors). Since Fibery doesn’t show rich text content within tables, (which would prerequisite adjustable row height anyway, which I hope is also on the radar), she cannot just export the table to excel, slightly adjust and print.

Is there any way to export chosen information including rich text fields into excel?
The workaround would be to export all non-rich-text fields, then add each rich text context individually, but this would be gruesome work for 150 entities.

Before I start going into a day-long loophole of trying something which in the end doesn’t work, I want to ask::
Could I use e.g. make.com to extract all fields incl. rich text content into a Google Sheet?

I guess my question boils down to the question: can you extract rich text content via API (which I believe you can), and has someone else already done this and could let me know his or her solution to this?

If not I guess it’s time for me to dig into some programming and Fibery’s API :grin:

The preferred endgoal would be to choose desired entities and with the click of a button create a “report” in form of a sheet including all desired information in the desired format.

1 Like

I guess this includes content in a rich-text field and in other fields?

You definitely can.

I actually think the easiest option may be to jump straight to this :slight_smile:

Out of curiosity, to what end is the exported/printed data to be put?
I mean, is there a reason why a Feed view might not be suitable (printed out or shared with relevant stakeholders if necessary)?

2 Likes

Correct, content in two rich-text fields to be exact.

Great, thanks for the confirmation. This probably means any desired format is programmable, I “just” need to learn how.

There are several reasons:

  • There is no print option which would allow to print the feed view in a visually appealing manner.
  • She needs two rich-text fields
  • You can show fields but cannot adjust how you want to see them (move, resize, format…). Also, you see only the contents, but not the field name. With varying content size it doesn’t look clean this way.

She needs to update a committee (consisting mainly of older people in high positions) about the status of each potential donor, so she prints a formatted table (~10 pages) with all the information, which she hands over to everyone before they go through it one by one.

How would you suggest I do this? My best guess is I need to learn some Javascript to “program” a button in Fibery that would extract the information (of selected Entities) from Fibery to a Google sheet:
→ Go to table XY
→ Create row
→ Assign and insert field contents (incl. rich-text) into the colums

From there, she can do some formatting adjustments and print it out.

Does this sound about right? Will diving into the API docs and start with some simple proof-of-concept be the way to go?

Thank you for your inputs!

1 Like

What is the ideal format of the data to be produced/exported from Fibery? CSV?
Also, do the rich text fields contain a lot of Fibery specific content (mentions, linked highlights, etc)?

1 Like

I am interested in knowing whether Fibery has this capability so I’m going to describe the ideal world, could you tell me how much of that would be possible?

Let’s say I would like to be able to select 50 entitites (Contacts) and click a button and get an already formatted table like this:

where:

  • Depending on a value in a category field the entity is shown under in progress, open, or rejected
  • Already formatted as shown i.e. adjusted font size to column, column width…
  • Status shows all or e.g. the most recent 5 “updates” which are another type linked to contacts.

Just as in the image above?


Similarly but in a different context (HR), could I with the click of a button create a Word or PDF document for e.g. an employment contract out of an entity?

I know you can create documents using markdown, but I am thinking of having a pre-configured word document with data fields in them where the data like name, position and so on just goes into these placeholder data fields and gives out a PDF?

1 Like

This is unfortunately not possible, and I imagine it is very unlikely to be something that Fibery would ever support.

Indeed you can, but it is not a very WYSIWYG approach, so I understand why it isn’t appealing.

At this stage, I think the easiest option would be to create an automation that transfers the rich text contents to a simple text field (solely used for this purpose and hidden on entity view) and create a Table view with the columns laid out as you need.
You can then export as CSV.
You can sort by stage (In progress, Open, etc.) but you won’t get the separator rows as shown in your image, but if you drop the csv into Excel, you can probably apply some conditional formatting to make it easier to interpret.

2 Likes

A script something like this should do the trick:

const fibery = context.getService('fibery');

for (const entity of args.currentEntities) {
    const entityWithExtraFields = await fibery.getEntityById(entity.type, entity.id, ['Description']);
    var doc = await fibery.getDocumentContent(entityWithExtraFields['Description']['Secret']);
    doc = doc.replace(/\n\n/g,'\n')
    await fibery.updateEntity(entity.type, entity.id, {'Simple': doc });
}

The doc.replace part is just to convert the double line breaks in markdown into a single line break in the simple test field.

2 Likes

This is very unfortunate. I think document creation is something you use in many functions, you could create invoices, offers, letters, HR documents, reports, and much much more. If you need an extra program, so be it. Maybe I’m too enthusiastic with Fibery’s potential… maybe I’m not :smiling_face:

For now, it doesn’t sound impossible to send relevant information via an API to a Google Doc template, no?

Indeed. But maybe doing it the other way is an option: first create a MD on Fibery, then find an automated solution to merge that to a document template with logos etc.

Many thanks for all your help, including this script. I’ll try implementing it, never played around with scripts before. I assume I’ll need to adjust some pieces to match with my space and add it into a button → execute Javascript, is that correct?

I just meant that an integration with Word was unlikely. I think document generation in general is certainly not off the table.

I haven’t experimented, but I would imagine that the workspace export from Fibery would lend itself quite well to an integration with a document merge tool.

Yeah, you’ll just need to replace the names ‘Description’ and ‘Simple’ with the names of your text fields (rich text and normal text respectively).

So a generic version for multiple rich->simple looks like this:

const fibery = context.getService('fibery');

for (const entity of args.currentEntities) {
    const entityWithExtraFields = await fibery.getEntityById(entity.type, entity.id, ['RichTextFieldName2','RichTextFieldName3','RichTextFieldName4']);

    var doc1 = await fibery.getDocumentContent(entityWithExtraFields['RichTextFieldName1']['Secret']);
    doc1 = doc1.replace(/\n\n/g,'\n');
    var doc2 = await fibery.getDocumentContent(entityWithExtraFields['RichTextFieldName2']['Secret']);
    doc2 = doc2.replace(/\n\n/g,'\n');
    var doc3 = await fibery.getDocumentContent(entityWithExtraFields['RichTextFieldName3']['Secret']);
    doc3 = doc3.replace(/\n\n/g,'\n');
    var doc4 = await fibery.getDocumentContent(entityWithExtraFields['RichTextFieldName4']['Secret']);
    doc4 = doc4.replace(/\n\n/g,'\n');

    await fibery.updateEntity(entity.type, entity.id, {'SimpleTextFieldName1': doc1 , 'SimpleTextFieldName2': doc2 , 'SimpleTextFieldName3': doc3 , 'SimpleTextFieldName4': doc4 });
}
2 Likes

Thanks a lot for this!

The replace part of the code gave back an error when used on an entity with an empty rich text field (can’t replace null).

Replacing the replace lines

doc1 = doc1.replace(/\n\n/g,‘\n’);

with

if (doc1) {doc1 = doc1.replace(/\n\n/g,‘\n’)};

fixes the issue. Just in case someone sees this post and runs into the same issue.

Thanks @Eren_Turgut.
I’m not particularly good at writing error handling into my code :face_with_open_eyes_and_hand_over_mouth:

1 Like