Create Excel document with DocumentFormat.OpenXml gives 'DocumentFormat' could not be found

I am trying to create an excel file including graphs from C# script.
For that I try to use the DocumentFormat.OpenXml library
I import it and I can see that the import was done correctly
but when I try to compile the program I get the error
The type or namespace name ‘DocumentFormat’ could not be found (are you missing a using directive or an assembly reference?)
I use
using DocumentFormat.OpenXml; 3.0.2.0
using DocumentFormat.OpenXml.Framework; 3.0.2.0
using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml.Spreadsheet;
using X14 = DocumentFormat.OpenXml.Office2010.Excel;
using X15 = DocumentFormat.OpenXml.Office2013.Excel;

I have downloaded the libraries from https://www.nuget.org/
I have tried with spreadsheetlight.3.5.0
but in the end I get the same error: ‘DocumentFormat’ could not be found.
If I compile and run the code in VS 2022 ir runs correctly.
I took the example from Creating Excel File Using OpenXML

Could you help me to solve this error please?

Hi guy.
You can use other library.
if you need step by step, you can inbox private to me.

Hello Hafles.

There is a procedure to follow if you want to import an external .NET library.

To import a .NET DLL and use on the scripts, follow the steps below:

  1. Add the Reference

Go to Run\Build\References, then click “add DLL References”, like the following image.

  1. Select the DLL file.

  2. In the pop-up window, select the domain where the lib will be visible.

if you don’t know what to choose, select “ServerAndClient”.

  1. Add the “using” command into your script class to access your methods.

*same syntax from VisualStudio.

Best Regards.
Tatsoft Team.