
click on multiple links and save as pdf
1 view (last 30 days)
Show older comments
I have 40 links imported in an excel sheet. Each link,when clicked, will lead to (Print as file) window for the page.
Is there anyway to open the multiple link, save the page as PDF with specific format (Year_Month_date) with one click ?
Regards
0 Comments
Answers (1)
Purvaja
on 5 Sep 2025
Hi @Jabbar Khan
I have come together with a concise solution using MATLAB and headless Chrome, which you can run from MATLAB to automate the entire workflow. I have made a dummy excel sheet ("dummy_links.xlsx") with links of random websites. After running the below MATLAB script, we will have a folder called "PDFs" which will save all these links sequentially with name in the date format ("yyyy-mm-dd"). Each PDF is saved with sequential date as (e.g., 2025_09_01, 2025_09_02, …) so the filenames follow a daily sequence.
% Read links from Excel
T = readtable('dummy_links.xlsx');
urls = T.Links;
startDate = datetime(2025,9,1);
outDir = fullfile(pwd, 'PDFs');
if ~exist(outDir, 'dir')
mkdir(outDir);
end
% Path to Chrome
chromePath = '"..\chrome.exe"';
% Loop through each link
for i = 1:numel(urls)
url = urls{i};
fileDate = startDate + caldays(i-1);
dateStr = datestr(fileDate, 'yyyy_mm_dd');
fileName = sprintf('%s.pdf', dateStr);
outFile = fullfile(outDir, fileName)
cmd = sprintf('%s --headless --disable-gpu --print-to-pdf="%s" "%s"', ...
chromePath, outFile, url);
status = system(cmd);
if status == 0
fprintf('Saved PDF: %s\n', outFile);
else
warning('Failed for URL: %s\n', url);
end
end
This will create a folder named "PDFs" in the same folder and should look like:

Hope this helps you!
0 Comments
See Also
Categories
Find more on Spreadsheets in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!