We have updated Flexmonster Software License Agreement, effective as of September 30, 2024. Learn more about what’s changed.

How to mask data when exporting data to CSV, Excel

Answered
Janez asked on July 3, 2023

Hi,
I would like to ask how can we apporach to acheive our customr reqest to mask data when exporitng data to CSV, Excel.
So in Flexmonster grid we have folowing data for example:
ID      FirstName     LastName  Registration
1        Joško           Blažič        1.1.2023
2        Marko          Kržič         1.2.2023
Desired CSV, Excel output. Each field have propery that it should or not to be masked.
ID      FirstName     LastName  Registration
1        ****            ****         1.1.2023
2        ****            ****         1.2.2023
 
Thnk you
Janez
 

5 answers

Public
Maksym Diachenko Maksym Diachenko Flexmonster July 4, 2023

Hello, Janez!

Thank you for your question.

The following functionality can be achieved by customizing the export via the exportTo() API call. By setting the destination: "plain" property in the export options, the exported Excel will be returned to the callback handler function as the Uint8Array object. In the callback handler, you can process the exported Excel to mask certain cells' data. This can be done with third-party libraries for working with Excel spreadsheets like SheetJS or ExcelJS:

pivot.exportTo("excel", { destination: "plain" }, 
function (res) {
let excelData = res.data;
//Your export handler here
}
);

In case you would like to make this functionality accessible from the Toolbar's export tab, you can replace the export handler through the toolbar customization.

Please let us know if the suggested approach works for you.

Best Regards,
Maksym

Public
Maksym Diachenko Maksym Diachenko Flexmonster July 18, 2023

Hello, Janez!

Hope you are doing well.
We are wondering if you were able to implement the solution for masking columns on export. 
Looking forward to hearing your feedback.

Best Regards,
Maksym

Public
Maksym Diachenko Maksym Diachenko Flexmonster July 27, 2023

Hello, Janez!

Just checking in to ask if you tried implementing the custom export functionality.
Please let us know if the suggested approach works for you.

Best Regards,
Maksym

Public
Janez August 7, 2023

Thank you for your response. We tired in this direction but the cutomre chaged the specification and we don't need this functionality for now.
You can close this case for now.

Public
Maksym Diachenko Maksym Diachenko Flexmonster August 7, 2023

Hello, Janez!

Thank you for your reply.
Feel free to contact us if more questions arise.

Best Regards,
Maksym

Please login or Register to Submit Answer