Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

Thu May 29, 2025 2:59 pm

Target Framework: .NET 8
Package: Spire.Office 7.5.4

Question: Is writing to multiple worksheets parallelly thread-safe?

We have a use case where we need to write data to multiple worksheets. We are exploring the use of
Code: Select all
worksheet.Range[rowIndex, columnIndex].Value = data
to write to a cell. We experimented with both sequential processing and parallel execution. Sequential processing turned out to be slow. When processing parallelly, we see some improvement in the performance. The question is: is writing to different worksheets parallelly thread-safe? During the testing, we didn't encounter any issues, but there may be.

Please note that, we are not trying to write parallelly in the same worksheet. Each worksheet will be processed in a separate thread. So, the question is more about whether we can process multiple worksheets parallelly.

prabin_slb
 
Posts: 3
Joined: Thu May 29, 2025 2:44 pm

Fri May 30, 2025 9:40 am

Hello,

Thanks for your inquiry.
Our Spire.XLS supports Parallel writing to different worksheets (thread-safe). However, please note that if there are data relationships between your sheets, issues might occur – for example, if Sheet2 references data from Sheet1.
I noticed you're using an older version of Spire.Office. I recommend updating to the latest version(10.2.0) to try it out. The new version includes more fixes and offers better stability.
If you have any other questions, please feel free to write back.

Sincerely,
Tommy
E-iceblue support team
User avatar

Tommy.Tang
 
Posts: 85
Joined: Mon Apr 21, 2025 7:05 am

Return to Spire.XLS

cron