Ian Rankin is leading a campaign to make the final part of Muriel Spark's archive available to the public.

The crime author studied Spark's novels as a student and was writing a PhD on her work when his own writing took off.

The National Library of Scotland (NLS) is trying to raise £250,000 to buy a tranche of documents, manuscripts and letters kept by the famous author from the 1940s up to her death in 2006.

The author of The Prime Of Miss Jean Brodie was a self-confessed "hoarder" of documents and her boxed archive takes up 46m of shelving.

She reportedly threw little away and the archive is said to contain fascinating letters, diaries, photographs, newspaper cuttings and school magazines - as well as used train tickets, old passports and car repair receipts.

NLS already has a large part of the archive, said to be "one of the most comprehensive records of a writer's life ever assembled", and the money raised will be used to buy the remaining parts and catalogue the entire contents to make it fully accessible for the public to see and study.

Agreement was made with Spark in 1992 to buy her archive and the library has been "progressively acquiring it" over the years.

Rebus author Rankin has always been fascinated by the work of the Edinburgh-born writer and wants to see the archive in the city.

He spent three years studying Spark's work for a PhD at Edinburgh University but never completed it as his own writing career took over.

"As a long-time fan of Muriel Spark's writing, I'm determined her treasure trove of an archive should have its home in Edinburgh, the city of her birth and the setting for her most famous work," Rankin said.

"Muriel Spark's novels are compelling - charming and witty, complex and puzzling, dark and shocking. She also led an extraordinary life, and this is what is revealed in the archive, an archive that belongs right here."

NLS has already taken delivery of the final instalment of the archive which will remain in sealed boxes until the money is raised to complete the purchase.

Other writers' archives are held in the NLS but "none has so deliberately and carefully preserved such a complete record of their life as Muriel Spark", the library said.

The project to catalogue the archive fully will take years because of its size.

National librarian John Scally said: "Completing the acquisition of this magnificent archive will be a major coup for the library that will be welcomed by many people who have long admired Muriel Spark's work.

"There is work to be done to create a full catalogue of what is in all these boxes but when that is complete, the full detail of what the archive contains - and the remarkable stories it tells - will be made clear and become accessible.

"A number of the library's supporters have already donated a substantial sum and we are very grateful for their contribution. We are confident that the total will be achieved."